User Tools

Site Tools


Let's encrypt SSL

Install SSL for Godaddy web hosting through cpanel.

  1. Install certbot on your local machine:
    sudo apt-get update
    sudo apt-get install software-properties-common
    sudo add-apt-repository universe
    sudo add-apt-repository ppa:certbot/certbot
    sudo apt-get update
    sudo apt-get install certbot python-certbot-apache
  2. Generate SSL Certificate
    sudo certbot certonly --manual
  3. Install on Godaddy
    1. Open fullchain.pem and copy the top half of the file (only the first certificate).
    2. Log in to your GoDaddy cPanel. In the Security section, click SSL/TLS. Under Certificates (CRT), click “Generate, view, upload, or delete SSL certificates.”
    3. Paste the first half of the certificate under “Upload a New Certificate”, where it says, “Paste the certificate into the following text box:” Type a description and click “Save Certificate.”
    4. Under “Install and Manage SSL for your site (HTTPS),” click “Manage SSL sites.”
    5. Under “Install an SSL Website,” select your first domain. Click “Autofill by Domain” and the certificate should populate in the first box. (All 3 boxes may be automatically populated.)
    6. Open privkey.pem and copy the content to the private key field
    7. If the “Certificate Authority Bundle” is not filled in, copy the second half of the fullchain.pem file to the field.
  1. Click “Install Certificate.”
2018/02/22 09:59 · johnny · 0 Comments · 0 Linkbacks

Control R figure output format

To control the site wide option, use

nano Rhome/etc/

The home path (Rhome) can be found using

R.home(component = "home")

On Ubuntu, it is often /usr/lib/R.

In the, input


will change the default output to svg instead of pdf.

2016/11/07 14:25 · johnny · 0 Comments · 0 Linkbacks

Batch Convert YouTube DASH m4a audio (youtube-dl) to m4a (AAC DL)

The YouTube DASH audio might not be played by some audio players. If you have multiple files with such format, you can convert them using the following command on Windows.

 FOR %i IN (*) DO  C:\Users\Downloads\ffmpeg-20160725-fb91850-win64-static\ffmpeg-20160725-fb91850-win64-static\bin\ffmpeg -i "%i" -vn -acodec copy "new\%i"

Note that you need to download ffmpeg first from here: Remember where you save the ffmpeg file (the directory to it).

Then open the command line window and navigate to the folder with the files to convert. From there issue the above command. Note that the converted files will be saved into the folder “new”.

2016/07/30 16:05 · johnny · 0 Comments · 0 Linkbacks

Install shiny server on Godaddy cloud server

I am trying out the Goddy cloud server with the following specific:

No more than
$5.00 /month
($0.0074 /hour)
512MB memory
1 core processor
20GB SSD disk
1TB transfer

However, when I install the shiny package, I got the following error message

g++: internal compiler error: Killed (program cc1plus)

It turned out there was enough memory on the server. I was able to solve the problem by temporarily adding a larger swap file using the method discussed here:

To do it, use the following script

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Then, install the package using

CXXFLAGS="-g -O2 --param ggc-min-expand=0  --param ggc-min-heapsize=8192" sudo su - -c "R -e \"install.packages('shiny', repos='')\""
2016/07/01 17:01 · johnny · 0 Comments · 0 Linkbacks

Setup up Mattermost with existing Gitlab

Based on

I was trying to set up mattermost with Gitlab I have installed on an Apache2 server in Ubuntu from source. The follow procedure proved to work for me.

Install Docker

  • Download and install Docker
    sudo apt-get update
    sudo apt-get install wget
    wget -qO- | sh
    sudo usermod -aG docker <username>
    sudo service docker start
    newgrp docker
  • Set up your dockerhost address by editing your /etc/hosts file to include the following line dockerhost
  • Install build essentials
    apt-get install build-essential

Install Go

If you installed the Gitlab 8+, you should already have GO installed.

Install Node.js

curl -sL | sudo -E bash -
sudo apt-get install -y nodejs

Install mysql server 5.6 or above

sudo apt-get update
sudo apt-get install mysql-server-5.6

After that, create a databased called mattermost

Mattermost Server

  • Download the latest Mattermost Server by typing:
    tar -xvzf mattermost.tar.gz
  • Create the storage directory for files.
    sudo mkdir -p /mattermost/data
    sudo chown -R username /mattermost
  • Configure Mattermost Server by editing the config.json file at mattermost/config
    • cd ~/mattermost/config
    • Edit the file by typing: nano config.json
    • replace DataSource“: “mmuser:mostest@tcp(dockerhost:3306)/mattermost?charset=utf8mb4,utf8 with your own mysql database name and password
  • Test the Mattermost Server
    cd ~/mattermost/bin

    You should see a console log like

    Server is listening on :8065

    if it runs correctly.

  • Stop the server for now by pressing ctrl-c
  • Setup Mattermost to use the Upstart daemon which handles supervision of the Mattermost process.
    sudo nano /etc/init/mattermost.conf

    Copy the following lines into /etc/init/mattermost.conf

    start on runlevel [2345]
    stop on runlevel [016]
    chdir /home/ubuntu/mattermost
    setuid ubuntu
    exec bin/platform
  • Test the setup by starting the service using
    sudo start mattermost

    Verify the service is running by typing: curl

    You should see a page titles Mattermost - Signup if running correctly.

Setup up the Apache2 server

  • Create a config file using
    sudo nano /etc/apache2/sites-available/mattermost.conf
  • In the file, include the following (note to change your domain name):
     <VirtualHost *:80>
      ProxyPreserveHost On
      RewriteEngine     On
      RewriteCond %{REQUEST_URI}  ^/api/v1/websocket      [NC,OR]
      RewriteCond %{HTTP:UPGRADE} ^WebSocket$             [NC,OR]
      RewriteCond %{HTTP:CONNECTION} ^Upgrade$            [NC]
      RewriteRule .* ws://{REQUEST_URI}   [P,QSA,L]
      RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME}    !-f
      RewriteRule .*{REQUEST_URI} [P,QSA,L]
      # Be sure to uncomment the next 2 lines if https is used
      # RequestHeader set X-Forwarded-Proto "https"
      # Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"
      # Prevent apache from sending incorrect 304 status updates
      RequestHeader unset If-Modified-Since
      RequestHeader unset If-None-Match
      <Location /api/v1/websocket>
         Require all granted
         ProxyPassReverse ws://
      <Location />
         Require all granted
  • Start the service by using
    sudo a2enmod proxy
    sudo a2enmod proxy_balancer
    sudo a2enmod proxy_http
    sudo a2enmod mod_proxy_wstunnel
    sudo a2enmod headers
    sudo a2ensite mattermost
    sudo service apache2 reload

Then you can point to mattermost in your web browser.

Using Gitlab as Single-Sign-On

2016/04/22 16:37 · johnny · 0 Comments · 0 Linkbacks

<< Newer entries | Older entries >>

Blog History

Note. Everything on this blog only reflects my personal view which may or may not be true and is not related to any organization or institute.

Page Tools