(def ptrn | |
{ | |
:a {:pattern #"a(?!b)" | |
:purpose "Only allow a if it is not preceded by a 'b' (negative lookahead)" | |
:samples ["acdefg" ; ok | |
"abcdef" ; nil | |
]} | |
:b {:pattern #"(?i)(<title.*?>)(.+?)(</title>)" |
WARNING: If you're reading this in 2021 or later, you're likely better served by reading:
(This gist was created in 2013 and targeted the legacy GOPATH mode.)
$ ssh -A vm
$ git config --global url."[email protected]:".insteadOf "https://github.com/"
# -*- coding: utf-8 -*- | |
''' | |
功能: | |
从zonefile文件导入域名到Dnspod | |
requirements: | |
dnspython==1.10.0 | |
requests==1.0.4 | |
''' |
mkvirtualenv datascience | |
sudo apt-get install python-scipy libblas-dev liblapack-dev gfortran | |
sudo apt-get install libffi-dev # for cryptography from scrapy | |
sudo apt-get install libxslt-dev # for libxml from scrapy | |
export BLAS=/usr/lib/libblas.so | |
export LAPACK=/usr/lib/liblapack.so | |
pip install numpy | |
pip install scipy | |
pip install scikit-learn | |
pip install pandas |
(defn- debounce-future | |
"Returns future that invokes f once wait-until derefs to a timestamp in the past." | |
[f wait wait-until] | |
(future | |
(loop [wait wait] | |
(Thread/sleep wait) | |
(let [new-wait (- @wait-until (System/currentTimeMillis))] | |
(if (pos? new-wait) | |
(recur new-wait) | |
(f)))))) |
/** | |
* This casper scipt checks for 404 internal links for a given root url. | |
* | |
* Usage: | |
* | |
* $ casperjs 404checker.js http://mysite.tld/ | |
* $ casperjs 404checker.js http://mysite.tld/ --max-depth=42 | |
*/ | |
/*global URI*/ |
(defvar mode-line-cleaner-alist | |
`((auto-complete-mode . " α") | |
(yas-minor-mode . " γ") | |
(paredit-mode . " Φ") | |
(eldoc-mode . "") | |
(abbrev-mode . "") | |
(undo-tree-mode . " τ") | |
(volatile-highlights-mode . " υ") | |
(elisp-slime-nav-mode . " δ") | |
(nrepl-mode . " ηζ") |
;; (require '[clojure.string :as str] '[clojure.java.shell :as shell] '[taoensso.timbre :as timbre]) | |
(defn with-free-port! | |
"Attempts to kill any current port-binding process, then repeatedly executes | |
nullary `bind-port!-fn` (which must return logical true on successful | |
binding). Returns the function's result when successful, else throws an | |
exception. *nix only. | |
This idea courtesy of Feng Shen, Ref. http://goo.gl/kEolu." | |
[port bind-port!-fn & {:keys [max-attempts sleep-ms] |