Tuesday, November 18, 2014

Gandi CNAME records to map google sites


Map a google site to a custom domain.
  1. Click the More Actions button and select Manage Site.
  2. Click the Web Address tab.
  3. Enter your custom URL in the Web Address text box, then click the Add button at the top of the page.
GANDI CNAME records to map google site.
Enter your CNAME record using the examples listed in the CNAME record values table and the guidelines below: Name: Enter your custom URL prefix (such as mail or www).
Type: Select CNAME.
Value: Enter ghs.googlehosted.com., making sure to include a trailing dot (.) at the end of the value.

Be aware it may take as long as 72 hours before DNS changes are propagated, depending on the time to live (TTL) that was configured for your records. Until records have been updated worldwide, you will still receive traffic to your old server.


You can check DNS propagation with this tool:
In my case it took a few hours before the new CNAME was propagated in the whole world. The first DNS server to be updated were in California, it's as if they use a shorter time to live for CNAME records. 10 hours later there was only one DNS srever in Malaysia that wasn't up to date. 

Data manipulation with dplyr

Dplyr is a package for data manipulation developed by Hadley Wickham and Romain Francois for the R statistical software.

  • Introduction to dplyr
  • A Tutorial from João Neto (dplyr.Rmd) gives examples of tools for grouped operations: 
    • n(): number of observations in the current group
    • n_distinct(x): count the number of unique values in x.
    • first(x), last(x) and nth(x, n) - these work similarly to x[1], x[length(x)], and x[n] but give you more control of the result if the value isn’t present.
    • min(), max(), mean(), sum(), sd(), median(), and IQR()

Non standard evaluation

dplyr uses non standard evaluation. To use standard evaluation a work around has to be found. See Stackoverflow question.

Thursday, November 13, 2014

GNU screen for long running server processes

Use screen to keep a long process running on a server after you close the ssh session. I started a screen session with:
    screen -S sessionname
In order to find the screen session later you might want to rename it using sessionname. Or on the first screen invocation use the s flag -S sessionname
I started the R software in this screen session, started a long running process. Then detached the session with:
    CTRL-A-D
I could re-attach the session later with:
    screen -r sessionname
If the session was not detached properly, it might be necessary to detach it and re attach it:
   screen -d -r sessionname
Screen detach before leaving the ssh session. You may want to use the autodetach configuration option.

Log out of your ssh session. Log in back again later:
screen -ls # list sessions
screen -r sessionname # attach a session

There might be solutions to move an already started process to GNU screen but its not straightforward:
"You cannot do this, easily. I'd suggest making it a habit to start screen as the first thing you do after opening a console. However, for your actual problem, there's another thing you could try: after having launched your job from the terminal, background it by typing ctrl-z and then bg. After that, detach the job from it's parent shell; in bash you'd do disown -h %. After that, you can safely close the terminal and the job will continue running."

More tips in this discussion on screen.

Thursday, November 06, 2014

SSH tunnel and port forwarding


  Ubuntu Remote_Port_Forwarding

        ssh -C -D 1080 laptop

    http://straightedgelinux.com/blog/howto/socks.html
        ssh -N -D 1080 klaatu@home.linuxserver.com
    https://wiki.debian.org/SOCKS


http://www.debian-administration.org/article/449/SSH_dynamic_port_forwarding_with_SOCKS

        ssh -D 1080 shell.example.org
        tsocks thunderbird