Skip to content

Instantly share code, notes, and snippets.

. /etc/skel/.bashrc
unalias -a
for p in $HOME/bin $HOME/contrib/bin; do
test -d "$p" || continue
case :$PATH: in *:"$p":*);; *) PATH=$p:$PATH;; esac
done
LESS=-qMX
export LESS
(when (file-exists-p "~/.emacs.d/site-start.d/")
(autoload 'my-site-start "my-site-start/my-site-start" nil t)
(my-site-start "~/.emacs.d/site-start.d/") )
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(tool-bar-mode nil))
@tripleee
tripleee / dotfiles.sh
Last active August 29, 2015 14:26
Download dotfiles from gists
#!/bin/sh
case $1 in -v) set -- -nv ;; *) set -- -q ;; esac
u=https://gist.githubusercontent.com/tripleee
while read dest id source; do
destname=${dest#dot.}
case $destname in "$dest") ;; *) destname=.$destname;; esac
wget -O "$destname" $1 -p "$u/$id/raw/"
done <<'____HERE'
@tripleee
tripleee / ansi-term-select-or-create.el
Created August 27, 2015 12:17
ansi-term wrapper to make it behave like regular M-x shell when invoking
(defun ansi-term-select-or-create ()
"Switch to the `*ansi-term*' buffer if it already exists; if not, create it
first."
(interactive)
(switch-to-buffer (or (get-buffer "*ansi-term*") (ansi-term "/bin/bash"))))
@tripleee
tripleee / aquamacs.el
Last active November 6, 2015 12:05
Customizations for Aquamacs
;(tool-bar-mode -1) ;; Not just Aquamacs -- everywhere, always
(tabbar-mode -1)
;; http://www.emacswiki.org/emacs/AquamacsFAQ#toc19
(one-buffer-one-frame-mode -1)
;; http://www.emacswiki.org/emacs/AquamacsEmacsCompatibilitySettings
(setq special-display-regexps nil
ns-alternate-modifier nil) ;; Don't use Alt for Meta
;; Add MELPA for magit, and probably others in the future
(eval-after-load "package"
'(add-to-list 'package-archives
@tripleee
tripleee / printable.el
Created December 2, 2015 06:32
Convert control and high-bit characters to printable (^A; \234)
(while (search-forward-regexp "[\000-\011\013-\037\200-\377]" nil t)
(let ((c (string-to-char (match-string 0))))
(backward-delete-char 1)
(insert
(if (< c 128)
(concat "^" (char-to-string (+ 64 c)))
(format "\\%03o" c) )) ))
@tripleee
tripleee / dygraphs.md
Last active December 17, 2015 10:31
dygraphs devel notes
@tripleee
tripleee / days.bash
Created December 18, 2015 09:33
days.bash
# Put this in your .bashrc or similar
# Requires GNU date for -d @epoch and +%F/+%s
days () {
local now=$(date +%s);
local d;
for ((d=$(date -d "$1" +%s); d < now; d += 24*60*60)); do
date -d @"$d" +%F;
done ;
}
@tripleee
tripleee / gist:2a4dc7781621d135ef987e53801da162
Created April 21, 2016 05:49
Python regex Unicode equivalents
# http://stackoverflow.com/questions/36715487/finding-%C3%BC-u-with-umlaut-using-regular-expressions/36716670#comment61099969_36716670
>>> import re, regex
>>> print re.__version__
2.2.1
>>> print regex.__version__
2.4.94
>>> pair = (u'f\u00fcr', u'fu\u0308r')
>>> for s in [re, regex]:
... for i,j in [(0, 1), (1, 0), (0,0), (1,1)]:
... if s.match(pair[i], pair[j], s.UNICODE):
// Consecutive, leave early on validation failure
// ... assuming abort(); leaves the current block (function, or even program)
if (function1(param) == 1)
abort();
// else
dostuff1();
if (function2(param) == 2)
abort();
// else