mercredi 27 juin 2018

how to have a running desktop accessible with x2goserver on a VPS?

  • open a terminal via ssh root 

  • ssh root@xx.xx.xx.xx 

  • adduser username

  • usermod -aG sudo username

  • vim /etc/ssh/sshd_config

  • change sshd_config as follow: 

    • Port 443

    • PermitRootLogin no

    • StrictModes yes

    • PasswordAuthentication yes

    • PermitEmptyPasswords no

    • ChallengeResponseAuthentication no

    • UsePAM yes

    • X11Forwarding yes

    • AllowUsers username@xx.xx.xx.xx lucyliu@xx.xx.xx.xx

  • /etc/init.d/ssh restart 

  • connect with new user
  • ssh username@xx.xx.xx.xx -p 443

  • install MATE

    • sudo apt update && sudo apt upgrade -y
    • sudo apt install ubuntu-mate-desktop

  • install x2goserver 
    • sudo add-apt-repository ppa:x2go/stable
    • sudo apt-get update
    • sudo apt-get install x2goserver x2goserver-xsession

how to install and keep uptodate the latest version of firefox on debian?

First install:
  • open a terminal
  • wget -O FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US"
  • sudo mkdir /opt/firefox
  • sudo tar xjf FirefoxSetup.tar.bz2 -C /opt/firefox/
  • sudo mv /usr/lib/firefox-esr/firefox-esr /usr/lib/firefox-esr/firefox-esr_orig
  • sudo ln -s /opt/firefox/firefox/firefox /usr/lib/firefox-esr/firefox-esr


Getting the last update:
  • open a terminal
  • wget -O FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US"
  • sudo tar xjf FirefoxSetup.tar.bz2 -C /opt/firefox/
  • restart firefox

samedi 9 juin 2018

How to deploy fresh Grails 3 app on Heroku?

Préconditions:
  • create an account on heroku.com
  • having one free dyno not already created (two dyno is the maximum for a free heroku account currently)
  • install heroku CLI
  • install sdkman/grails3

Create a new grails default app and create a file named "Profile":


$ grails create-app myapp

$ cd myapp

$ touch Procfile

"Procfile" is important for heroku plateform to configure the way the app will be launched on the plateform, copy paste this in Procfile:

web: cd build ; java -Dgrails.env=prod -jar ../build/server/webapp-runner-*.jar --expand-war --port $PORT libs/*.war

Then open the project inside your favorite IDE and edit build.gradle by adding this at the end of the existing file:


task stage() {
    dependsOn clean, war
}
tasks.stage.doLast() {
    delete fileTree(dir: "build/distributions")
    delete fileTree(dir: "build/assetCompile")
    delete fileTree(dir: "build/distributions")
    delete fileTree(dir: "build/libs", exclude: "*.war")
}
war.mustRunAfter clean

task copyToLib(type: Copy) {
    into "$buildDir/server"
    from(configurations.compile) {
        include "webapp-runner*"
    }
}

stage.dependsOn(copyToLib)
and also add dependency
compile 'com.github.jsimone:webapp-runner:8.5.11.3'
in the dependency section.
This dependency is for heroku to launch the app/

Then the git part:

$ git init
Initialized empty Git repository in .git/
$ git add .
$ git commit -m "first comit"
Created initial commit 5df2d09: first commit
 44 files changed, 8393 insertions(+), 0 deletions(-)
 create mode 100644 README
 create mode 100644 Procfile
 create mode 100644 app/controllers/source_file
...

Then create the heroku remote repository:

$ heroku create
$ git remote -v
heroku https://git.heroku.com/thawing-inlet-61413.git (fetch)
heroku https://git.heroku.com/thawing-inlet-61413.git (push)
$ git push heroku master

Initializing repository, done. updating 'refs/heads/master'

check the result by using

$ heroku open


Sources:
https://devcenter.heroku.com/articles/git#prerequisites-install-git-and-the-heroku-cli
https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku

bash script to convert all mp4 in a folder to mkv files with ffmpeg

 #!/bin/bash for i in *.mp4; do   echo "$i" "${i%%.*}.mkv"   ffmpeg -i "$i" -vcodec copy -acodec copy "${...