Skip to content

Instantly share code, notes, and snippets.

;; Use % to match various kinds of brackets...
;; See: http://www.lifl.fr/~hodique/uploads/Perso/patches.el
(defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %."
(interactive "p")
(let ((prev-char (char-to-string (preceding-char)))
(next-char (char-to-string (following-char))))
(cond ((string-match "[[{(<]" next-char) (forward-sexp 1))
((string-match "[\]})>]" prev-char) (backward-sexp 1))
(t (self-insert-command (or arg 1))))))
(setq checkboxes '(("yesno" :options ("Yes" "No") :default "Yes")
("passfail" :options ("Pass" "Fail") :default "Pass")))
(defun create-checkboxes ()
(let ((choice-options (mapcar #'car checkboxes)))
(completing-read "Choices: " checkboxes nil t nil nil (first choice-options))))
(defun get-some-checkboxes ()
(let* ((choicekey (create-checkboxes))
(choicedefault (plist-get (cdr (assoc choicekey checkboxes)) :default))
(use-package guide-key
:ensure
:config
(progn
(setq guide-key/guide-key-sequence '("C-x r" "C-x v" "C-x 4" "C-x 8")
guide-key/popup-window-position 'bottom
guide-key/recursive-key-sequence-flag t)
(guide-key-mode 1))
class ECDF(object):
"""
One-dimensional empirical distribution function given a vector of
observations.
Parameters
----------
observations : array_like
An array of observations
## Modified solution of: http://superuser.com/a/180149
## If it is not pointing at an active socket, make the link.
if test "$SSH_AUTH_SOCK" ; then
real_sock=$(readlink ~/.ssh/ssh_auth_sock)
if [ -z "$real_sock" -o ! -S "$real_sock" ]; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
fi
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
CNAME responses to questions for NS? Not so good. ;(
$ dig open.mapquestapi.com ns @dns-01.ns.aol.com.
; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> open.mapquestapi.com ns @dns-01.ns.aol.com.
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27945
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4
# redirect to a startup page when there is no pidfile yet
RewriteEngine On
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{REQUEST_URI} !^/thruk/startup.html
RewriteCond %{REQUEST_URI} !^/thruk/side.html
RewriteCond %{REQUEST_URI} !^/thruk/.*\.(css|png|js)
RewriteCond %{REQUEST_URI} ^/thruk
RewriteCond /var/cache/thruk/thruk.pid !-f
RewriteRule ^(.*)$ /thruk/startup.html?$1 [R=302,L,NE,QSA]