Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash -e
remote_repo=""
gp_branch="gh-pages"
publish_dir="_build/html"
# Build Sphinx doc
echo "Build documentation."
rm -rf ${publish_dir}
make html
@linhai86
linhai86 / change_git_email.md
Created July 18, 2019 00:09
Change the name/email of previous commits.

Copy paste the following script, replace the following variables:

  • OLD_EMAIL
  • CORRECT_NAME
  • CORRECT_EMAIL
#!/bin/sh

git filter-branch --env-filter '
@linhai86
linhai86 / mut2seq.py
Created February 25, 2019 00:34
Given mutation, extract flanking protein sequence.
import requests
class Mut2Seq:
"""Given mutation, extract flanking protein sequence using Ensembl API.
"""
def __init__(self, server='https://rest.ensembl.org',
species='homo_sapiens'):
self.server = server
self.species = species
@linhai86
linhai86 / capture_webcam.md
Created October 14, 2018 20:29
Simple script to capture webcam and detect faces.

Simple script to capture webcam and detect faces.

import cv2

def capture_webcam():
    face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
    cap = cv2.VideoCapture(0)

 while(True):

Introduction

Lifecycles consist of phases, which can invoke a set of configured goals provided by certain plugins.

built-in build lifecycles:

  • default: handles your project deployment.
  • clean: handles project cleaning.
  • site: handles the creation of your project's site documentation.

default lifecycle comprises of the following main phases:

  • validate - validate the project is correct and all necessary information is available

Build

docker build -t username/repository:tag .

Ship

docker login my.registry.com:8000

docker tag <image> username/repository:tag

Create personal library directory and set it to default in Rstudio Server:

# Create .Rprofile file in the home folder and insert the following code:

.libPaths(c("/home/users/linh35/R/x86_64-pc-linux-gnu-library/3.2", .libPaths()))

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
# To re-config CPAN
cpan> o conf init

# To install packages with local::lib
perl -MCPAN -Mlocal::lib -e shell
cpan> install Statistics::R
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.