Skip to content

Instantly share code, notes, and snippets.

@ckirkendall
ckirkendall / clojure-match.clj
Created June 15, 2012 02:26 — forked from bkyrlach/Expression.fs
Language Compare F#, Ocaml, Scala, Clojure, Ruby and Haskell - Simple AST example
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})
@plux
plux / random_imgur.py
Created July 13, 2012 20:40
random_imgur tiny
import os, random, string, sys, urllib2
num_pics = 5
if len(sys.argv) > 1:
num_pics = int(sys.argv[1])
while num_pics > 0:
name = ''.join(random.sample(string.letters+string.digits, 5)) + '.jpg'
img = urllib2.urlopen("http://i.imgur.com/" + name).read()
if len(img) != 503: # 'image not found' is 503 bytes
@johnmurrayvi
johnmurrayvi / 51-android.rules
Last active November 26, 2021 14:41
Udev permission for android devices
## Acer
#SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0600", OWNER="<username>"
## ASUS
#SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0600", OWNER="<username>"
## Dell
#SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0600", OWNER="<username>"
## Foxconn
@Tarrasch
Tarrasch / README.md
Last active September 12, 2016 18:14
Unity plus xmonad configuration (Ubuntu 12.04)

What

This is my xmonad+unity panel config. With this config, you'll have a well integrated panel from unity but still have xmonad as your window manager with your gnome apps, including the pretty gnome-terminal (for those too lazy to learn xmoobar).

This config doesn't have the unity launcher, mainly becuse it causes windows to be unfloatable, besides I'm not fond of it anymore.

How

Copy and paste these lines (or understand what it does and do it manually).

@jacobvosmaer
jacobvosmaer / gist:3187346
Created July 27, 2012 10:35
Open all files with git merge conflicts in Vim

Open all files with git merge conflicts in MacVim

git diff --name-only | uniq | xargs mvim

When git encounters a merge conflict, e.g. during a rebase, it drops you back into the shell with a dirty working directory. I like this one-liner for opening all files with a merge conflict in MacVim.

Once you're in Vim, you can then switch between the files with :n and :prev, or another favourite: :w | n (save current file and open the next command line-supplied file).

UPDATE: see below for a version that works with real terminal commands.

@swannodette
swannodette / gist:3217582
Created July 31, 2012 14:52
sudoku_compact.clj
;; based on core.logic 0.8-alpha2 or core.logic master branch
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
import time
import win32api, win32con
VK_CODE = {'left_arrow':0x25,
'spacebar':0x20,
'right_arrow':0x27}
def press(x):
win32api.keybd_event(VK_CODE[x], 0,0,0)
win32api.keybd_event(VK_CODE[x],0 ,win32con.KEYEVENTF_KEYUP ,0)
@witoff
witoff / Poll_Coinbase.js
Last active December 15, 2015 08:39
Poll Coinbase for Coin Availability
/* COMPILED:
* Add this snippet as a bookmark and click while on this url:
* https://coinbase.com/buys to check for coin availability every 60 seconds.
* Will sound an audible alarm when coins are available, if using a compliant browser (use chrome).
* Note: Don't DDOS our friends at coinbase!
*/
javascript:var%20s%3Ddocument.createElement%28%27script%27%29%3Bs.setAttribute%28%27type%27%2C%20%27text/javascript%27%29%3Bs.innerHTML%3D%22var%20beep%3D%28function%28%29%7Bvar%20ctx%3Dnew%28window.audioContext%7C%7Cwindow.webkitAudioContext%29%3Breturn%20function%28duration%2Ctype%2CfinishedCallback%29%7Bduration%3D%2Bduration%3Btype%3D%28type%255%29%7C%7C0%3Bif%28typeof%20finishedCallback%21%3D%27function%27%29%7BfinishedCallback%3Dfunction%28%29%7B%7D%7Dvar%20osc%3Dctx.createOscillator%28%29%3Bosc.type%3Dtype%3Bosc.connect%28ctx.destination%29%3Bosc.noteOn%280%29%3BsetTimeout%28function%28%29%7Bosc.noteOff%280%29%3BfinishedCallback%28%29%7D%2Cduration%29%7D%7D%29%28%29%3B%24%28%27%23transfer_btc%27%29.fo

In case you don't know me already, I'm Jarrod Nettles, a Senior Developer at Apple Inc. I also go by the Twitter handle @hayvok, and blackshawk on Github (don't ask me why they're different). I have no real, formal blog since, well, I work at Apple. I'm posting this because I confused a good many people and I feel honor-bound to explain.

On April 1st Hacker News had their "Who's Hiring" thread. Since I'm currently looking for a developer, I decided to go ahead and post. Here's the content of that post, along with a link to the original.

https://news.ycombinator.com/item?id=5475813 - Original HN Post

Apple Inc: Cupertino, CA - Web Developer (PHP, Node.js, Ember.js) - Sorry, no remote!! Relocation offered. (I know, I know...) We're rebuilding an internal app from scratch and it needs to be blazing fast and real-time.
Here's our tech stack (right now).