Skip to content

Instantly share code, notes, and snippets.

View scotthaleen's full-sized avatar
λ

スコット scotthaleen

λ
View GitHub Profile
@scotthaleen
scotthaleen / GIF-Screencast-OSX.md
Created March 14, 2016 14:55 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@scotthaleen
scotthaleen / ConsCarCdr.js
Created February 10, 2016 16:31
JavaScript implementation of cons, car and cdr
function cons(x, y) {
return function(w) { return w(x, y) };
};
function car(z) {
return z(function(x, y) { return x });
};
function cdr(z) {
return z(function(x, y) { return y });
@scotthaleen
scotthaleen / vimium-emacs.md
Created January 8, 2016 17:50
Emacs-Style Key Bindings for Vimium

My Vimium Key Bindings (Emacs-Style)

This is a full set of key bindings (as of Vimium v1.45); covering all Vimium functionality. I have tried to map all Vimium functionality to comparable Emacs functionality (whenever possible). In cases where there is no equivalent, those commands are prefixed by <c-g> (indicating <c-g>oogle Chrome; and because <c-g> does not conflict with other Emacs shortcuts at all).

Commented Shortcuts: There are a few Emacs-style shortcuts that are simply not possible in Vimium. All of my shortcuts (including those which were not possible; i.e. where I used a decent alternative) have been commented below. This should help to clarify my rationale.

_Compatibility: All of these shortcuts were tested on Mac OS X (Mavericks). Please note that all of my shortcuts operate under the assumption that your Emacs Meta key is the Alt/Option key. This really was my only choice, because the key is already used in Chrome for shortcuts that c

(defvar helm-fzf-source
(helm-build-async-source "fzf"
:candidates-process 'helm-fzf--do-candidate-process
:nohighlight t
:requires-pattern 2
:candidate-number-limit 9999))
(defun helm-fzf--do-candidate-process ()
(let* ((cmd-args `("fzf" "-x" "-f" ,helm-pattern))
(proc (apply #'start-file-process "helm-fzf" nil cmd-args)))
@scotthaleen
scotthaleen / gmail_downloader.py
Created November 4, 2015 15:41
Download Gmail
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import imaplib
import email
from email.utils import getaddresses
import datetime
import getpass
import argparse
@scotthaleen
scotthaleen / lein_jars_local.txt
Created October 26, 2015 18:37
leiningen download project dependencies locally
# download transitive dependencies to local directory
lein pom
mvn dependency:copy-dependencies
ls -la target/dependency/
@scotthaleen
scotthaleen / elastic_bulk_ingest.py
Created October 22, 2015 19:29
Bulk Index json to elastic search
from pyspark import SparkContext, SparkConf
import json
import argparse
def fn_to_doc(line):
try:
doc = {}
data = json.loads(line)
doc['data'] = data
@scotthaleen
scotthaleen / spark_es_search_list.py
Last active August 29, 2015 14:24
Spark Elastic Search List
#!/usr/bin/env python
from pyspark import SparkContext, SparkConf
import urllib2
import json
conf = SparkConf().setAppName("ES Search List")
sc = SparkContext(conf=conf)
url='localhost:9200'
@scotthaleen
scotthaleen / emacs-list.sh
Created August 29, 2014 00:53
debian emacs install
wget -q http://londo.ganneff.de/apt.key -O- | apt-key add -
echo "deb http://londo.ganneff.de wheezy main" > /etc/apt/sources.list.d/emacs.list
aptitude update
aptitude install emacs-snapshot