Q: Does StatNet offer Dropbox alternative? Owncloud?

Server: https://owncloud.stat.ubc.ca/
Login and password are the same as StatNet
Disk quota 20Gb
Users can add their local storage or Dropbox/Goggle Drive  storage to their  Owncloud account

Dropbox: You will need App key and App secret from Dropbox for Owncloud client
to use Dropbox remote storage on its server.
Login Dropbox,
Create "Dropbox API app"
--> Files and Datastores

--> No, My app needs access to files already on Dropbox
--> All file types.


More info

There are 3 ways to access your files
a) Install a Desktop sync-client  How to here
     Sync Client download
           For Mac/Win/Linux
            For Smart Mobile Devices
b) Using a web browser
      Support all major browsers. No plugin required
c) WedDav
       How to here

Complete Owncloud Desktop client Document here.

Q: SSH without a password. Setup SSH Keys on a Linux / Unix System.

On you local Mac/Linux laptop/workstation do:
$ mkdir .ssh
$ ssh-keygen -t rsa -b 4096 -f .ssh/mykeys
It will generate 2 files:  mykeys   and    mykeys.pub inside the .ssh folder.
Use ' ssh-copy-id' command' to copy the keys to our Virtual server.

Notes: Mac OSX does not have' ssh-copy-id' command. 
Download here:  https://raw.githubusercontent.com/beautifulcode/ssh-copy-id-for-OSX/master/ssh-copy-id.sh

$ sudo curl https://raw.githubusercontent.com/beautifulcode/ssh-copy-id-for-OSX/master/ssh-copy-id.sh -o /usr/local/bin/ssh-copy-id
$ sudo chmod +x /usr/local/bin/ssh-copy-id

Now you can copy the newly generated key to Virtual server. (Replace 'stty2u' with your users login name)
$ /usr/local/bin/ssh-copy-id -i .ssh/mykeys stty2u [at] rcloud.stat.ubc.ca

Add your key to your laptop/workstation.
$ssh-add .ssh/mykeys

Test it
$ssh stty2u [at] rcloud.stat.ubc.ca

You should not be asked for password.
Q: How to mount/unmount StatNet home directory using sshfs?

We use "sshfs" to mount your StatNet home directory securely.
For your convenient, we created a sshfs script in "/usr/local/bin/statfiles".
For usage, type 'statfiles' at the command line terminal.

Notes: If you are running batch jobs, you should mount and unmount statfiles manually.
A) To manually Mount:
$statfiles mount
$cd statfiles

B) To manually  unmount
$statfiles unmount

Howto  Use "sshfs" to mount your StatNet home storage automatically
1) Edit .bash_profile and remove these hashes, using vim or emacs.
   $ emacs .bash_profile
        statfiles mount
        cd statfiles
2) To unmount statfiles after logout
Edit .bash_login and remove these hashes
   $ emacs .bash_logout
        cd ~
        /usr/local/bin/statfiles unmount
3)Logout and Login your VM again.
   You need to supply your StatNet passwd twice.  One for your VM and one for your StatNet Home directory to mount.
4) Confirm your StatNet location
   $ pwd
   $ ls
5) Now you can start running your code.
   $ program your_code here.

Do not save anything important on your local VM disk since it has limited snapshot and backup.
Your local VM files is saved for 7 days and every hours.

Q: How do I access my virtual server?

1) Using Ssh

SSHSecureShell https://owncloud.stat.ubc.ca/index.php/s/JDRoPRAeWrUHIZH
or Putty

Open a Terminal and type
ssh stat.ubc.ca -l {your login name without these parentheses}

Save your working data on

If you don't have the data folder ready, Email our IT help group

2) Using screen and Xpra

Q: What is my VM specs and softwares and how do I use it?

I) Virtual server specs:
RHEL6 64 bit OS.
initially has min 4 CPUs, 8Gb of RAM and
40Gb NFS mount of storage with 7 days local disk snapshot only.
You should use StatNet home directory as your main storage for better backup.
At anytime your project needs to have more CPU/Ram, email help at stat with brief
a explanation of why you need more resources.

Host: v{your_login_name}.stat.ubc.ca

Login/Passwd are the same as your StatNet
After you login, your VM will NOT mount your StatNet Home directory.
This is because we want you to understand how sshfs mounting work.
We created a sshfs script in "/usr/local/bin/statfiles"

II) Software installed:
 R statistics
 Xrpa/Screen for running app nohup remotely.
 Opensource development tools


Q: emacs

General Note (by Jenny Bryan): Everything like this has a learning curve, but, for all of the above, the ultimate benefits make this painful phase worth enduring.

External Resources

AUCTeX: editing LaTeX files in Emacs

AUCTeX is an Emacs package that makes editing LaTeX documents so much easier. It has been installed and configured on StatNet servers (as of November 1, 2005). However, if you want to use it on your own computer, you'll need to download the package and install it yourself (it doesn't come with Emacs by default).

When emacs opens a file with a .tex extension, the additional menus are named LaTeX and Command

  • From the LaTeX menu you can select many environments without typing them (e.g. begin{enumerate} ... end{enumerate}). There are also convenient shortcuts to make typing mouse-free and even faster (e.g. C-c C-e to insernt an environment).
  • From the Command menu, you can run the latex, xdvi and pdflatex programs, etc, and do a spell check that ignores latex commands. Shortcuts are also available and are, in fact, quite smart: it only takes a couple of rounds of C-c C-c to compile the file and open the result in xdvi.

This tip is provided by Harry Joe. Seconded by Mike Danilov.

ESS: Emacs Speaks Statistics

ESS a GNU Emacs and XEmacs mode for interactive statistical programming and data analysis. It is particulary good for R and S-PLUS. It has been installed and configured on StatNet servers (as of November 1, 2005) but you'll need to install it yourself if you want to use it on your own computer.

ESS can be used to save/edit interactive sessions in Splus and R (as well as SAS, stata and other statistical packages).

  1. To start R in emacs, type: Alt-X R (assuming Alt is your Meta key).
  2. Within the R command prompt, hit Alt-P to access previous R commands and Alt-N to access next R commands (which can then be edited); the list of previous commands is cyclic, so the first hit of Alt-N will lead to the first command of your present session. Note: in a properly configured environment Shift-UpArrow and Shift-DownArrow work as well.
  3. Requesting help on a function will bring the help documentation in a split screen, so that you can copy and paste the examples to run etc
  4. There is function name completion with TAB (similar to command/filename completion in the bash shell)
  5. more details about ESS, consult the help ess info within emacs (Crtl-h m, when in ESS)

This tip is provided by Harry Joe. Seconded by Jenny Bryan and Mike Danilov.

UltraTex and Lightning Completion

The UltraTex and Lightning Completion packages (play very nicely with AucTeX) will also really speed up writing LaTeX and will make it virtually impossible to have mismatched parentheses, opened/closed environments, references to non-existent figures/table/sections, etc. (and many other maddening mistakes).

This tip is provided by Jenny Bryan.

Go to Top

Q: Regular expressions: examples illustrating common uses

Most common regular expressions

[0-9] digit
[a-z] lower case letter
[A-Z] upper case letter
[0-9a-zA-Z] digit or letter
[ ] space
[ t] space or tab
[^0-9a-zA-Z] not digit or letter
[0-9][a-z] digit followed by letter
[0-9]{3,5} (vi, grep, emacs) 3 to 5 digits in a sequence
[0-9]{3,5} (perl) 3 to 5 digits in a sequence
[ ]+ (vi, grep) one of more spaces in a sequence
[ ]+ (emacs/viper, perl) one of more spaces in a sequence
. any symbol but n (end of line)
z.{2}o (grep, vi, emacs) z followed by 2 chars followed by o
^ beginning of line
$ end of line
^[ ]*$ line with zero or more spaces and nothing else (vi, perl, grep, emacs)
^$ empty line
^[^0-9a-zA-Z t] line beginning with non-digit,letter,space
[0-9][0-9]/[0-9][0-9]/[0-9]{4} (vi, emacs, grep) mm/dd/yyyy date format
(vim) word beginning with doc
bdoc (perl, emacs/viper, grep) word beginning with doc
ment> (vim) word ending with ment
mentb (perl, emacs/viper, grep) word ending with ment

Using regular expressions


put regexp in quotes, e.g. grep "^[ ]*$" files


for search use / or ? followed by regexp, for replacement, use something like :10,35s/regexp1/regexp2/g where the two numbers indicate the line range; this also works in 'sed' (stream editing/batch mode of vi), and no line range for sed means all lines (i.e, :1,$ )


ESC C-r or ESC C-s for searching for regexp M-x replace-regexp for replacement of regexp1 with regexp2

Complex regexp editing may be best done from sed or perl scripts.

Summary of perl regular expressions (from a perl book)

/abc/ matches 'abc' anywhere in string
/^abc/ matches 'abc' at beginning of string
/abc$/ matches 'abc' at end of string
/a|b/ matches 'a' or 'b'
/ab{2,4}c/ matches 'a' followed by 2-4 'b's followed by 'c'
/ab*c/ matches 'a' followed by 0 or more 'b's followed by 'c'
/ab+c/ matches 'a' followed by 1 or more 'b's followed by 'c'
/ab?c/ matches 'a' followed by 0-1 'b's followed by 'c'
/./ matches any character except 'n'
/[abc]/ matches any of the characters within []
/[^abc]/ matches a character not within [^]
/(abc)/ matches 'abc' anywhere in string, parentheses as a memory, storing 'abc' in the variables ,,, etc e.g. /name=(.*)&user=1/
/abc/i matches 'abc' ignoring case
/d/ or /[0-9]/ matches a digit
/w/ or /[a-zA-Z0-9_]/ matches a character classified as a word
/s/ or /[ rtnf]/ matches a character classified as whitespace
/b/ matches a word boundary or a backspace
/D/ or /[^0-9]/ matches a character that is not a digit
/W/ or /[^a-zA-Z0-9_]/ matches a character that is not a word
/S/ or /[^ rtnf]/ matches a character that is not whitespace
/helloB/ requires that there is not word boundary (after hello)
/*/ matches *

Submitted by Harry Joe, 2006-04-21

Q: Where are the informal computing seminars from 2000?

Note: to untar a file, type tar -xvf (filename)

   UNIX Tools and VI: 

[TXT] UsingVi.txt             20-Jan-2000 14:48     3k  

[TXT] UsingViEnh.txt          20-Jan-2000 14:48     5k  
[TXT] Using_at_.txt           20-Jan-2000 14:48     2k  
[TXT] Using_grep_.txt         20-Jan-2000 14:48     1k  
[TXT] Using_tar_.txt          20-Jan-2000 14:48     1k  
[TXT] ViFAQ.txt               20-Jan-2000 14:48     2k  
[   ] atdemo.s                20-Jan-2000 14:48     1k  
[   ] atdemoscript            20-Jan-2000 14:48     1k  
[   ] example.dat             20-Jan-2000 14:48     2k  
[   ] format.pl               20-Jan-2000 14:48     1k  
[   ] list.tex                20-Jan-2000 14:48     2k  
[   ] mailscript              20-Jan-2000 14:48     1k  
[   ] mailscript1             20-Jan-2000 14:48     1k  
[   ] seminar.tar             20-Jan-2000 16:54    75k  
[   ] students                20-Jan-2000 14:48    38k  
[   ] table2html.pl           20-Jan-2000 14:48     1k  
[   ] table2tex.pl            20-Jan-2000 14:48     1k  

#README #Informal Computing Seminar - January 20, 2000 UsingVi.txt How to Use VI UsingViEnh.txt How to Use some of VIM's features (and Harry's Perl scripts) Using_at_.txt Using at - a process scheduler Using_grep_.txt Using grep - a pattern matcher Using_tar_.txt Using tar - a file packager ViFAQ.txt FAQ for VI atdemo.s File Used for demo of at atdemoscript File Used for demo of at example.dat Data file for illustration format.pl Harry's Perl script to format text list.tex An example TeX file mailscript File Used for demo of at mailscript1 File Used for demo of at students An example file for grep table2html.pl Harry's Perl script to convert table to HTML table2tex.pl Harry's Perl script to convert table to TEX

Speaker: Mark Robinson

Date:        January 20, 2000

   C stuff

Speaker: Mark Robinson

Date:        June 1, 2000