Skip to content

Instantly share code, notes, and snippets.

@linhai86
linhai86 / linux_ftp_user_setting.md
Last active August 29, 2015 14:08
How to create FTP access for a user.

How to create FTP access for a user

mkdir /var/ftp/ftp_dir
sudo /usr/sbin/useradd ftp_user
sudo passwd ftp_user
sudo /usr/sbin/usermod -d /var/ftp/ftp_dir/ ftp_user # change user's home directory
sudo /usr/sbin/usermod -s /sbin/nologin ftp_user # deny ssh access
@linhai86
linhai86 / download.md
Last active August 29, 2015 14:09
Download a folder without downloading its parents

Download a folder without downloading its parents:

nohup wget -r -np -nH --cut-dirs=2 -R *index.html* --http-user=username --http-password=password https://www.example.com/aaa/bbb/ &

rsync

rsync -r -v -h -P --exclude "*.sam" username@host:~/source destination
@linhai86
linhai86 / digital_ocean_lamp_setup.md
Last active August 20, 2017 02:55
Digital Ocean LAMP Setup (Ubuntu 14.04)

[Initial Server Setup with Ubuntu 14.04] [1]

ssh root@SERVER_IP_ADDRESS

adduser demo

# Add the new user to the sudo group
gpasswd -a demo sudo

# Add public key to new remote user
@linhai86
linhai86 / Setup_Tomcat.md
Last active August 29, 2015 14:21
Setup Tomcat in Eclipse
  1. Download Apache Tomcat
  2. In Eclipse:
  3. Help -> Install New Software -> All Available Sites -> Web, XML, Java EE and OSGi Enterprise Development -> Eclipse Java EE Developer Tools and JST Server Adapters Extensions
  4. Window -> Preferences -> Server -> Runtime Enviroments -> Add -> Tomcat 8.0 (check "create a new local server")
  5. Window -> Show View -> Other -> Servers
  6. Right click on Tomcat server -> Properties -> Switch Location (Location should be changed)
  7. Double click on Tomcat server -> Server Locations -> Use Tomcat installation

In .vimrc:

filetype indent plugin on

set expandtab
set shiftwidth=4
set softtabstop=4

set number

Qsub script:

#!/usr/bin/bash
#$ -S bash
#$ -q all.q
#$ -pe smp 8
#$ -l h_rt=24:00:00
#$ -l s_rt=24:00:00
#$ -l h_vmem=48G
#$ -l gpu=4

Shared repo:

git clone <repo>
git checkout -b <branch>
git add <dir>
git commit -m "<message>"
git push -u origin <branch>
# Submit "Pull Request" on GitHub.
# After accepted:
git checkout master
conda info
conda update conda
conda update anaconda

conda info --envs                             # List all environments.
conda list                                    # List all packages and versions installed in active environment.
conda create --prefix ~/bio-env biopython     # Create an environment named bio-env in your home directory and install the biopython.
conda create --name bio-env biopython         # Create an environment in default directory.
source activate ~/bio-env                     # Activate env.
# To re-config CPAN
cpan> o conf init

# To install packages with local::lib
perl -MCPAN -Mlocal::lib -e shell
cpan> install Statistics::R

Reset Rstudio Server for a specific user.

My RStudio Server freezes after I login and the IT couldn't solve it.

  1. Find the ip address of the server
nslookup <hostname>
  1. SSH to the server