Skip to content

Instantly share code, notes, and snippets.

View RaymondSHANG's full-sized avatar

Raymond Yuan SHANG RaymondSHANG

View GitHub Profile
@RaymondSHANG
RaymondSHANG / restore_packages.R
Created October 10, 2017 19:36 — forked from arne-cl/restore_packages.R
save/load/install a list of your currently installed R packages
# restore_packages.R
#
# installs each package from the stored list of packages
# source: http://hlplab.wordpress.com/2012/06/01/transferring-installed-packages-between-different-installations-of-r/
load("~/installed_packages.rda")
for (count in 1:length(installedpackages)) {
install.packages(installedpackages[count])
}

Technical details for https://stackoverflow.com/a/44169445/6730571

Details of investigation:

On a base system, /usr/bin/java is a symlink that points to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, which is an Apple wrapper tool that locates and executes the actual java.

(Do not touch anything in those 2 system directories. It should actually be impossible due to "System Integrity Protection" anyway.)

If you don't have Java installed, attempting to execute java will open a dialog that invites you to install it.

@RaymondSHANG
RaymondSHANG / R2PBS.md
Created November 30, 2018 22:57 — forked from brfitzpatrick/R2PBS.md
How to submit R code to a Portable Batch System (PBS) managed HPC resource (e.g. QUT's High Performance Computing Facility `Lyra').

How to submit R code to a Portable Batch System (PBS) managed High Performance Computing (HPC) Facility (e.g. QUT's HPC Facility 'Lyra').

You will need:

  1. An account with the relevant HPC facility (QUT staff and HDR students can request access to the QUT facility here),
  2. the R Script (.R file) you want to run,
  3. a Job Script (.sub file) that tells Lyra how to run your R script and,
  4. a file containing any data your R Script needs to run.

Note: These instructions work on a system running Debian (GNU + Linux) with the Gnome Desktop Environment.

@RaymondSHANG
RaymondSHANG / style_guide.md
Created July 17, 2020 09:05 — forked from scottfrazer/style_guide.md
WDL Best Practices / Style Guide

"My First WDL" Template

task name {
  String in
  command {
    echo '${in}'
  }
  output {
 String out = read_string(stdout())
@RaymondSHANG
RaymondSHANG / gitignore_per_git_branch.md
Created October 6, 2022 02:56 — forked from wizioo/gitignore_per_git_branch.md
HowTo have specific .gitignore for each git branch

How to have specific .gitignore for each git branch

Objective

My objective is to have some production files ignored on specific branches. Git doesn't allow to do it.

Solution

My solution is to make a general .gitignore file and add .gitignore.branch_name files for the branches I want to add specific file exclusion. I'll use post-checkout hook to copy those .gitignore.branch_name in place of .git/info/exclude each time I go to the branch with git checkout branch_name.

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.