Skip to content

Instantly share code, notes, and snippets.

@gnarmis
gnarmis / minmaxheap.py
Created January 27, 2013 10:01
min max heap implementation in python
from math import log, floor, pow
class MinMaxHeap(object):
"""an implementation of min-max heap using an array,
which starts at 1 (ignores 0th element)
"""
def __init__(self, array=[]):
super(MinMaxHeap, self).__init__()
@gnarmis
gnarmis / yummly-api.clj
Last active December 14, 2015 17:59
Yummly API
(defn yummly-api [auth]
{:endpoint "http://api.yummly.com/v1"
:resources {:recipe-search "/api/recipes"}
:params ["q", "requirePictures", "allowedIngredient[]", "excludedIngredient[]",
"allowedDiet[]", "allowedAllergy[]", "allowedCuisine[]",
"allowedCourse[]", "allowedHoliday[]", "excludedCuisine[]",
"excludedCourse[]", "excludedHoliday[]", "maxTotalTimeInSeconds",
"nutrition.ATTR.{min|max}", "maxResult", "start",
"flavor.ATTR.{min|max}", "facetField[]"]
:auth {"_app_id" (:app-id auth),
{
/* Keybindings for emacs emulation. Compiled by Jacob Rus.
*
* To use: copy this file to ~/Library/KeyBindings/
* after that any Cocoa applications you launch will inherit these bindings
*
* This is a pretty good set, especially considering that many emacs bindings
* such as C-o, C-a, C-e, C-k, C-y, C-v, C-f, C-b, C-p, C-n, C-t, and
* perhaps a few more, are already built into the system.
*

Setting up Emacs daemon on OS X

Tired of waiting for emacs to start on OS X? This step by step guide will teach you how to install the latest version of emacs and configure it to start in the background (daemon mode) and use emacsclient as your main editor.

Install Homebrew

First you'll need to install the [Homebrew package manager][brew] if yo haven't already. It is amazing.

@gnarmis
gnarmis / .emacs.minimal
Last active August 29, 2015 14:01
Minimal Emacs Config for Fast Startup
; Want a fast emacs startup? Copy this to ~/.emacs.minimal and:
;
; cp ~/.emacs ~/.emacs.bak
; echo "(load-file \"/absolute/path/to/.emacs.minimal\")" > ~/.emacs
;
; Switch it back if you don't like it.
;
;; cutoff for word wrap
(setq-default fill-column 79)
@gnarmis
gnarmis / git-recent-branches
Last active August 29, 2015 14:01
List Git Branches by Recency
#!/bin/bash
#
# Blame @gnarmis if this doesn't work
#
# Put this anywhere on your $PATH (~/bin is recommended). Then git will see it
# and you'll be able to do `git recent-branches`.
#
# Show top 5 most recent branches:
# $ git recent-branches | head -n 5
#
@gnarmis
gnarmis / gist:0d08ad5603014efea52f
Last active August 29, 2015 14:02
Swift on the Command Line
So, this is where swift lives, after you've installed XCode 6 Beta:
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
Also, there's a directory named swift which has various libraries:
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift
To start playing in a terminal:
@gnarmis
gnarmis / spooky_say.js
Created October 31, 2015 22:05
Spooky Say
function spookysay(s){
m = new SpeechSynthesisUtterance(s);
m.voice = speechSynthesis.getVoices().filter(function(voice) {return voice.name == 'Whisper'})[0];
speechSynthesis.speak(m)
}
spookysay('I know what you did last summer!')
@gnarmis
gnarmis / Preferences.sublime-settings
Created April 5, 2017 21:37
my sublime text user settings
{
"color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme",
"ensure_newline_at_eof_on_save": true,
"trim_trailing_white_space_on_save": true,
"font_size": 14,
"ignored_packages":
[
"Vintage"
],
"tab_size": 2,
@gnarmis
gnarmis / nodesource_setup_8
Created April 2, 2018 21:16
copy of https://deb.nodesource.com/setup_8.x, but without the atrocious ssl cert related error preventing secure `curl`s
#!/bin/bash
# Discussion, issues and change requests at:
# https://github.com/nodesource/distributions
#
# Script to install the NodeSource Node.js v8.x LTS Carbon repo onto a
# Debian or Ubuntu system.
#
# Run as root or insert `sudo -E` before `bash`:
#