Skip to content

Instantly share code, notes, and snippets.

@smhanov
smhanov / dawg.py
Last active April 26, 2023 16:01
Use a DAWG as a map
#!/usr/bin/python3
# By Steve Hanov, 2011. Released to the public domain.
# Please see http://stevehanov.ca/blog/index.php?id=115 for the accompanying article.
#
# Based on Daciuk, Jan, et al. "Incremental construction of minimal acyclic finite-state automata."
# Computational linguistics 26.1 (2000): 3-16.
#
# Updated 2014 to use DAWG as a mapping; see
# Kowaltowski, T.; CL. Lucchesi (1993), "Applications of finite automata representing large vocabularies",
# Software-Practice and Experience 1993
@carlosmcevilly
carlosmcevilly / pbclean
Created September 24, 2014 22:06
pbclean
#!/bin/bash
pbpaste | pbcopy
@dacort
dacort / cookiemonster.go
Created September 23, 2014 06:51
Simple script to extract (encrypted) cookies out of Chrome OS X cookie store. Usage: ./cookiemonster domain.com
package main
import (
"code.google.com/p/go.crypto/pbkdf2"
"crypto/aes"
"crypto/cipher"
"crypto/sha1"
"database/sql"
"fmt"
"log"
package com.cad97.spawnercraft;
import net.minecraft.block.BlockMobSpawner;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@bloodyowl
bloodyowl / gist:6543749
Created September 12, 2013 21:02
Jony Ive bullshit generator
;(function(){
var text = [
[
"Right from the beginning, it appeared to us that designing the new"
, "When we first thought about it, we understood that designing the new"
]
, [
" iPhone"
, " iMac"
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@murtaugh
murtaugh / 1. single-line.html
Last active April 21, 2021 16:23
Blockquote patterns for ALA
<figure class="quote">
<blockquote>It is the unofficial force—the Baker Street irregulars.</blockquote>
</figure>
@cawoodm
cawoodm / NodeSP v0.01.js
Created October 21, 2012 18:12
NodeSP (Node Server Pages) is a proof of concept on using Node.js as a web server serving dynamic content generated from .js scripts akin to PHP or other CGI scripts.
var http = require('http'),
url = require('url'),
vm = require('vm'),
fs = require('fs');
// Process request and send response to client
exports.run = function(request, response) {
var res = this.process(request);
response.statusCode = res.statusCode||200;
response.setHeader("Content-Type", res.contentType||"text/html");
public static class Sequence
{
public static IEnumerable<T> Memoize<T>(this IEnumerable<T> sequence)
{
return new MemoizedSequence<T>(sequence);
}
}
// This code is for illustration and is not production-ready.
@joemccann
joemccann / nginx + node setup.md
Created October 25, 2010 02:06
Set up nginx as a reverse proxy to node.js.

The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).

In a nutshell,

  1. nginx is used to serve static files (css, js, images, etc.)
  2. node serves all the "dynamic" stuff.

So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.

  1. nginx listens on port 80.