Skip to content

Instantly share code, notes, and snippets.

View lgastako's full-sized avatar

John lgastako

  • Francon & Heyer
  • Milky Way Galaxy, Third Rock from the Sun
View GitHub Profile
@pepijndevos
pepijndevos / lisp.py
Created September 10, 2010 09:56 — forked from dahlia/lisp.rb
5 minutes Lisp in Python
# 5 minutes Lisp in Python
# Pepijn de Vos <http://pepijndevos.nl>
#
# Inspired by 30 minutes Lisp in Ruby
# http://gist.github.com/562017
#
# This Lisp does not read or parse anything at all.
# A generator and a Decorator are abused to run sexps.
#
# Usage:
@defunkt
defunkt / zombies.md
Created December 29, 2010 22:57
—All You Zombies— by Robert A. Heinlein

All You Zombies

2217 Time Zone V (EST) 7 Nov. 1970--NTC-- "Pop's Place": I was polishing a brandy snifter when the Unmarried Mother came in. I noted the time---10:17 P. M. zone five, or eastern time, November 7th, 1970. Temporal agents always notice time and date; we must.

The Unmarried Mother was a man twenty--five years old, no taller than I am, childish features and a touchy temper. I didn't like his looks---I never had---but he was a lad I was here to recruit, he was my boy. I gave him my best barkeep's smile.

Maybe I'm too critical. He wasn't swish; his nickname came from what he always said when some nosy type asked him his line: "I'm an unmarried mother." If he felt less than murderous he would add: "at four cents a word. I write confession stories."

If he felt nasty, he would wait for somebody to make something of it. He had a lethal style of infighting, like a female cop---reason I wanted him. Not the only one.

@kyleburton
kyleburton / simple-ivr-simulator.sh
Created February 16, 2011 21:04
Simple IVR Simulator for testing out user experience (Works on OSX)
VOICE="Vicki"
BALANCE="100"
function voice_prompt () {
echo " SPEAKING: $1"
say -v "$VOICE" "$1"
}
function get_user_keypress () {
KEY=""
@zackthehuman
zackthehuman / hexagons.js
Created February 20, 2012 03:46
Drawing a hexagonal grid with HTML canvas
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Canvas Hexagonal Map</title>
<style type="text/css">
canvas {
border:0;
display:block;
margin:0 auto;

Don't use MongoDB

I've kept quiet for awhile for various political reasons, but I now feel a kind of social responsibility to deter people from banking their business on MongoDB.

Our team did serious load on MongoDB on a large (10s of millions of users, high profile company) userbase, expecting, from early good experiences, that the long-term scalability benefits touted by 10gen

@clintongormley
clintongormley / gist:3888120
Created October 14, 2012 09:44
Upgrading a running elasticsearch cluster

Yesterday I upgraded our running elasticsearch cluster on a site which serves a few million search requests a day, with zero downtime. I've been asked to describe the process, hence this blogpost.

To make it more complicated, the cluster was running elasticsearch version 0.17.8 (released 6 Oct 2011) and I upgraded it to the latest 0.19.10. There have been 21 releases between those two versions, with a lot of functional changes, so I needed to be ready to roll back if necessary.

Our setup:

  • elasticsearch

We run elasticsearch on two biggish boxes: 16 cores plus 32GB of RAM. All indices have 1 replica, so all data is stored on both boxes (about 45GB of data). The primary data for our main indices is also stored in our database. We have a few other indices whose data is stored only in elasticsearch, but are updated once daily only. Finally, we store our sessions in elasticsearch, but active sessions are cached in memcached.

@karlseguin
karlseguin / spec.go
Last active February 20, 2018 19:42
A simple test helper for Go. See http://openmymind.net/Testing-In-Go/
package tests
import (
"testing"
)
type S struct {
t *testing.T
}
@lynaghk
lynaghk / gist:5174289
Created March 16, 2013 00:30
Hacky "tagged literals" in JSON.
;;5-minute sketch of tagged literals in JSON via the little known second argument to the browser's JSON.parse.
;;It's no EDN, but it's still a hell of a lot nicer than the usual JSON-deserialization state of affairs.
(ns shim.json
(:require [goog.date.DateTime :as DateTime]))
(defn parse-tagged-string
"Parse a tagged string within JSON.
Assumes string begins with a throwaway first character and there is a single space between the tag and its data."
;;framework.clj
;;...
(definterface ES
(putIfAbsent [k v])
(rep [k old-val new-val])
(get [k]))
(defn ^ES jes []
(let [m (atom {})]
(reify ES
@pera
pera / .ghci
Last active November 3, 2017 13:01
GHCi dot file
-- You need to install IPPrint and HsColour with cabal to use this config.
-- If you find all the loading messages anoying you may want to set an alias:
-- alias ghci="ghci -v0"
-- Or if you are using stack ghci:
-- alias ghci="stack --silent ghci --ghci-options -v0"
:set -XNoMonomorphismRestriction
:set prompt "\ESC[34mλ\ESC[m "
-- remove the following comments if ghci >= v7.8.1 for multiline support: