Table of Contents
regex
Replace $abc$ with $`abc`$: \$([^$]*)\$ \$`\1`\$
Replace 4. 5 with 4.5
(\d)[.]\s+(\d) $1.$2 ([a-zA-Z])[.]([a-zA-Z]) $1. $2
Let's encrypt SSL
Install SSL for Godaddy web hosting through cpanel.
- 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
- Generate SSL Certificate
sudo certbot certonly --manual
- Install on Godaddy
- Open fullchain.pem and copy the top half of the file (only the first certificate).
- Log in to your GoDaddy cPanel. In the Security section, click SSL/TLS. Under Certificates (CRT), click “Generate, view, upload, or delete SSL certificates.”
- 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.”
- Under “Install and Manage SSL for your site (HTTPS),” click “Manage SSL sites.”
- 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.)
- Open privkey.pem and copy the content to the private key field
- If the “Certificate Authority Bundle” is not filled in, copy the second half of the fullchain.pem file to the field.
- Click “Install Certificate.”
Control R figure output format
To control the site wide option, use
nano Rhome/etc/Rprofile.site
The home path (Rhome) can be found using
R.home(component = "home")
On Ubuntu, it is often /usr/lib/R.
In the Rprofile.site, input
options(device='svg')
will change the default output to svg instead of pdf.
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: https://ffmpeg.org/. 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”.
Install shiny server on Godaddy cloud server
I am trying out the Goddy cloud server with the following specific:
20GB 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: http://lacey.se/posts/compiling-dplyr-on-low-memory-vps/
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='http://cran.rstudio.com/')\""
<< Newer entries | Older entries >>
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.