This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo '[{"key": 1}, {"key": 2}, {"key": 1}]' | jq 'group_by (.key)[] | {key: .[0].key, length: length}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From http://stackoverflow.com/a/16154053/1351718 | |
# x is a 10 x 3 matrix | |
x = matrix(rnorm(3*10), ncol=3) | |
y = rnorm(10) | |
res = glm(y~x) | |
# ignore the intercept pval | |
summary(res)$coeff[-1,4] < 0.05 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; See: http://www.emacswiki.org/emacs/PrettyLambda | |
(defun pretty-lambdas () | |
(font-lock-add-keywords | |
nil `(("(\\(lambda\\>\\)" | |
(0 (progn (compose-region (match-beginning 1) (match-end 1) | |
,(make-char 'greek-iso8859-7 107)) | |
nil)))))) | |
;; Insert lambda |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro ensure-installed-package (package &rest body) | |
"Ensures PACKAGE is installed and then performs body. Place package configurations in BODY" | |
(declare (indent 1)) | |
`(progn | |
(when (not (package-installed-p ,package)) | |
(package-install ,package)) | |
,@body)) | |
;; USAGE: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_branch() { | |
git branch --no-color 2>/dev/null | awk '/\*/ {print $2}' | |
} |