Skip to content

Instantly share code, notes, and snippets.

View gigawhitlocks's full-sized avatar
🗽

Ian Whitlock gigawhitlocks

🗽
View GitHub Profile
show2d [x] = show x
show2d (x:xs) = show x ++ "\n" ++ show2d xs
multiples :: Integer -> [[Integer]]
multiples x = filter ((1 /=).(length)) $
map (\y->filter ((0 ==).(`mod` y)) [1 .. x]) [1..x]
#!/bin/sh
# Snarf a file or the output of a command into the
# X11 paste buffer using xclip(1).
if [ -z $1 ]; then
name=`basename $0`
echo "Usage: $name [command] <arg1> ... <argN>, or"
echo " $name [file]"
exit 1
fi
function sudowoodo() {
read -p "Are you sure? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo mkfs.ext4 /dev/sda
fi
}
@gigawhitlocks
gigawhitlocks / gist:6607410
Created September 18, 2013 10:39
fizzbuzz
(define fizzbuzz
; this is a default-args wrapper
(lambda ()
(fizzbuzz-iter 1)))
(define fizzbuzz-iter
(lambda (iter)
; the actual meat of fizzbuzz
@gigawhitlocks
gigawhitlocks / gist:7453896
Created November 13, 2013 18:28
Opens first argument in a local emacs session that's already running, from the shell on a remote machine.
function evil() {
if [ $SSH_CLIENT ];
then if [[ $1 == /* ]];
then ssh ian@$(echo $SSH_CLIENT | awk '{print $1}') -C emacsclient /ubuntu@isw-dev:$1;
else ssh ian@$(echo $SSH_CLIENT | awk '{print $1}') -C emacsclient /ubuntu@isw-dev:$(pwd)/$1;
fi
else vim;
fi
}
### Keybase proof
I hereby claim:
* I am gigawhitlocks on github.
* I am ianwhitlock (https://keybase.io/ianwhitlock) on keybase.
* I have a public key whose fingerprint is E429 3E94 559A 251A 1C45 AE18 C47C DD6C 4019 B337
To claim this, I am signing this object:
@gigawhitlocks
gigawhitlocks / gif.el
Created January 27, 2016 23:28
emacs gif creator
(defun gif-emacs (duration)
(interactive "sDuration: ")
(start-process "emacs-to-gif" nil
"byzanz-record"
"-d" duration
"-w" (number-to-string (+ 5 (frame-pixel-width)))
"-h" (number-to-string (+ 50 (frame-pixel-height)))
"-x" (number-to-string (frame-parameter nil 'left))
"-y" (number-to-string (+ (frame-parameter nil 'top) 10))
(concat "~/emacs_gifs/" (format-time-string "%Y-%m-%dT%T") ".gif")))
@gigawhitlocks
gigawhitlocks / create_destroy_esx.py
Created February 12, 2016 18:12
example of creating/destroying an ESXi instance in VCA
from pyvcloud.vcloudair import VCA
from pprint import pprint
import os
import time
import uuid
class ESXInstance(object):
def __init__(self, password=os.getenv("vca_password"),
username=os.getenv("vca_username"),

The News

Time

date

Calendar

Keybase proof

I hereby claim:

  • I am gigawhitlocks on github.
  • I am ianwhitlock (https://keybase.io/ianwhitlock) on keybase.
  • I have a public key whose fingerprint is 17C0 6195 3CBA 8E76 F9C9 9BB5 8941 9A7A 5E79 2775

To claim this, I am signing this object: