Skip to content

Instantly share code, notes, and snippets.

View YiLiu6240's full-sized avatar

Yi Liu YiLiu6240

View GitHub Profile
@YiLiu6240
YiLiu6240 / .bashrc
Created February 2, 2017 12:21 — forked from henrik/.bashrc
Git branch and dirty state in Bash prompt.
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@YiLiu6240
YiLiu6240 / setup-pdf-tools-msys2.org
Created September 26, 2016 10:23 — forked from justbur/setup-pdf-tools-msys2.org
Install pdf-tools on windows with msys2

Notes for compiling and setting up pdf-tools using msys2

Steps

  1. Open msys2 shell
  2. Get pdf-tools
    git clone https://github.com/politza/pdf-tools
    cd pdf-tools
        
@YiLiu6240
YiLiu6240 / create-package-list.R
Created August 14, 2016 11:59 — forked from whatalnk/create-package-list.R
docset of R installed packages
# Package list
create.package.list <- function(){
make.packages.html(temp = TRUE)
file.copy(from = file.path(tempdir(), ".R/doc/html/packages.html"), to = file.path("doc", "html"), overwrite = TRUE, copy.date = TRUE)
doc <- htmlTreeParse(file.path("doc", "html", "packages.html"), useInternal = TRUE)
oldNode <- newNode <- querySelector(doc, ".toplogo")
xmlAttrs(newNode)["src"] <- "logo.png"
addAttributes(newNode, width = "100", height = "78")
@YiLiu6240
YiLiu6240 / example.openmp.r
Created July 27, 2016 08:39 — forked from doobwa/example.openmp.r
OpenMP Rcpp example
#!/usr/bin/r
library(inline)
library(rbenchmark)
## openMPCode example from Rcpp/examples/OpenMP/ by Dirk E.
openMPCode <- '
// assign to C++ vector
std::vector<double> x = Rcpp::as<std::vector< double > >(xs);
@YiLiu6240
YiLiu6240 / parse-options.sh
Created April 15, 2016 11:13 — forked from cosimo/parse-options.sh
Example of how to parse options with bash/getopt
#!/bin/bash
#
# Example of how to parse short/long options with 'getopt'
#
OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
echo "$OPTS"
@YiLiu6240
YiLiu6240 / ST_RegexSearchMultiLine
Last active August 31, 2015 15:09 — forked from clemblanco/ST_RegexSearchMultiLine
Sublime Text 2 Regex Multiline Search
<head>((?!</head>).|\n)+</head>
\\begin\{longtable\}((?!\\end\{longtable\}).|\n)+\\end\{longtable\}
consequat(.|\n)+laborum
@YiLiu6240
YiLiu6240 / scopes.txt
Last active August 29, 2015 14:25 — forked from iambibhas/scopes.txt
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee