Skip to content

Instantly share code, notes, and snippets.

@cjdurkin
cjdurkin / mdpreview
Created January 22, 2017 23:05
Markdown preview with pandoc
#!/bin/bash
FILE=${1:-README.md}
fn=$(mktemp /tmp/md-$(uuidgen).html)
pandoc --from markdown --to html $FILE --output $fn
open $fn
### Keybase proof
I hereby claim:
* I am cjdurkin on github.
* I am cdurkin (https://keybase.io/cdurkin) on keybase.
* I have a public key whose fingerprint is A5CF DB68 4A95 D9AB 05B2 71E1 15C6 84BF 25FD 8C06
To claim this, I am signing this object:
#!/bin/bash
while [ 1 ]; do
find ~ | perl -MList::Util=shuffle -e 'print shuffle<STDIN>' | head -n 1 | xargs xxd -c 32
sleep 2
done
@cjdurkin
cjdurkin / cut-n-paste-me
Last active November 2, 2015 18:43
Fun characters
ಠ_ಠ
¯\_(ツ)_/¯
#!/usr/bin/python
import json
import fileinput
text = "".join(line for line in fileinput.input())
data = json.loads(text)
print(json.dumps(data, sort_keys=True, indent=4))
#!/usr/bin/env python
import time, sys
epoch = float(sys.argv[1])
ans = time.localtime(epoch)
if ans.tm_year > 3000:
ans = time.localtime(epoch/1000.0) # milliseconds
@cjdurkin
cjdurkin / backup-dir.el
Created May 13, 2015 17:45
backup code for emacs
;;; backup-dir.el --- allow backup files to live in some other directory(s).
;;; Author: Greg Klanderman <greg.klanderman@alum.mit.edu>
;;; Version: 2.9
;;; Date: January 8, 1999
;;; Created: Spring 1992
;;; Keywords: backup file
;;; Copyright (C) 1992-98 Greg Klanderman
;;;
@cjdurkin
cjdurkin / .emacs
Last active March 25, 2016 13:39
dot emacs
;; .emacs
(setq user-mail-address "user@example.com")
;; turn off default init
(setq inhibit-default-init t)
;; text mode default for new buffers
(setq default-major-mode 'text-mode)