Skip to content

Instantly share code, notes, and snippets.

View YiLiu6240's full-sized avatar

Yi Liu YiLiu6240

View GitHub Profile
@YiLiu6240
YiLiu6240 / jupyter-ipython-multiple-output.py
Created November 16, 2017 09:22
Multiple output in one shell
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / 2016-09-30_debug.md
Last active September 30, 2016 09:50
debug information for gscholar-bibtex-google-scholar-search-results
(let* ((query "test")
       (url-request-method "GET")
       (random-id (format "%016x" (random (expt 16 16))))
       (expiration (format-time-string "%a, %d %b %Y %H:%M:%S.00 %Z"
                                       (time-add (current-time)
                                                 (seconds-to-time 3600)) t))
       (my-cookie (mapconcat #'identity
                             (list (format "GSP=ID=%s:CF=4; " random-id)
                                   (format "expires=%s" expiration)
@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);
lsm = function() {
modes = c("numeric", "character", "list", "function")
for (mode in modes) {
cat(sprintf("mode: %s", mode), "\n")
print(ls.str(mode=mode, envir=globalenv()), max.level=0)
cat("\n")
}
}
@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 / spacemacs_custom_theme.el
Created April 12, 2016 10:52
customized spacemacs theme to be solarized-like
(defun dotspacemacs/user-init ()
(custom-set-variables '(spacemacs-theme-custom-colors
'(
;; (base . "#b0c2c2")
(base . "#839496")
(act2 . "#132126")
(border . "#b58900")
(bg1 . "#132126")
;; (bg2 . "#002b36")
(bg2 . "#132b34")