Skip to content

Instantly share code, notes, and snippets.

Jarrell Waggoner malloc47

Block or report user

Report or block malloc47

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
malloc47 / oneline.tex
Last active Dec 15, 2015
Example of LaTeX snippet that keeps text on a single line, but resizes it to fit the width, if it would otherwise wrap.
View oneline.tex
\ifthenelse{\lengthtest{\namewidth < \textwidth}}%
{#1}% do nothing if shorter than text width
{\resizebox{\textwidth}{!}{#1}}% scale down
View bit.clj
(ns bit)
(defn printb
(Integer/toBinaryString n))
(defn count-1s
(->> n printb (filter #{\1}) count))
View matrix.clj
(ns matrix)
(defn mget
[m i j]
(-> m (nth j) (nth i)))
(defn mset
[m i j v]
(assert (and (< j (count m))
(< i (count (first m)))))
View sequence.clj
(defn happy-next
(let [digits (->> n str seq (map #(Character/digit % 10)))]
(->> (map * digits digits)
(apply +))))
(defn happy'
[n seen]
(loop [n n seen seen]
sudo apt-get install emacs
# caps -> ctrl
setxkbmap -layout us -option ctrl:nocaps
# or
sudo apt-get install gnome-tweak-tool
# disable super key
xmodmap -e 'keycode 133 = NoSymbol'
xmodmap -e 'keycode 134 = NoSymbol'
# change setting
def to_latex(a,label='A \\oplus B'):
sys.stdout.write('\[ '
+ label
+ ' = \\left| \\begin{array}{'
+ ('c'*a.shape[1])
+ '}\n' )
for r in a:
for c in r[1:]:
sys.stdout.write(' & '+str(c))
malloc47 /
Last active Dec 3, 2017
OS X Sierra Keybindings Per Application Using Hammerspoon

OS X Sierra + VirtualBox + Hammerspoon

I prefer different modifier keybindings for my VM vs. native OS X, but VirtualBox (unlike VMWare/Parallels) passes the keyboard through to the VM natively without the ability to remap it on the way through.

Apparently one would normally use Karabiner to do all manner of trickery to remap keys per application etc. but support for this utility was broken in OS X Sierra. Instead, I use a pair of scripts:

read -p "environment: " env
read -p "user: " user
read -s -p "password: " password
if [ "$env" == "prod" ] ; then
elif [ "$env" == "blue" ] ; then
You can’t perform that action at this time.