Skip to content

Instantly share code, notes, and snippets.

@creationix
creationix / chatServer.js
Created November 19, 2010 20:47
A simple TCP based chat server written in node.js
// Load the TCP Library
net = require('net');
// Keep track of the chat clients
var clients = [];
// Start a TCP Server
net.createServer(function (socket) {
// Identify this client
@keeganstreet
keeganstreet / Vim plugins
Created April 17, 2011 09:52
Adding a Vim plugin as a git submodule
# From http://vimcasts.org/episodes/synchronizing-plugins-with-git-submodules-and-pathogen/
# Add a Vim plugin as a git submodule
git submodule add http://github.com/tpope/vim-fugitive.git bundle/fugitive
git add .
git commit -m "Install Fugitive.vim bundle as a submodule."
# Update all submodules
git submodule foreach git pull origin master
@masak
masak / explanation.md
Last active June 18, 2024 08:24
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <jnthn@jnthn.net>
Date:   Sun Apr 15 16:35:03 2012 +0200

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.

@1wErt3r
1wErt3r / SMBDIS.ASM
Created November 9, 2012 22:27
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
function termFreqMap(str) {
var words = str.split(' ');
var termFreq = {};
words.forEach(function(w) {
termFreq[w] = (termFreq[w] || 0) + 1;
});
return termFreq;
}
function addKeysToDict(map, dict) {
@pascalpoitras
pascalpoitras / config.md
Last active June 23, 2024 15:33
My WeeChat configuration

WeeChat Screenshot

Mouse


enable


@wooorm
wooorm / treebankTokenizer.js
Created January 19, 2014 12:58
Penn Treebank Tokenizer in JavaScript. Based on both the Sed script by Robert McIntyre ([cis.upenn.edu][1]), and the Python port by Edward Loper and Michael Heilman ([nltk.org][2]). [1]: http://www.cis.upenn.edu/~treebank/tokenizer.sed [2]: http://nltk.org/_modules/nltk/tokenize/treebank.html
/**
* Author: Titus Wormer <tituswormer@gmail.com>
* URL: http://wooorm.com/penn-treebank-tokenizer-in-javascript.html
*
* The Treebank tokenizer uses regular expressions to tokenize text as in
* Penn Treebank. This implementation is a based on both the Sed script
* written by Robert McIntyre (available at
* [http://www.cis.upenn.edu/~treebank/tokenizer.sed]), and the Python port
* by Edward Loper and Michael Heilman (available at
* [http://nltk.org/_modules/nltk/tokenize/treebank.html]).
@UniIsland
UniIsland / list-manually-installed-packages.sh
Created February 8, 2014 08:20
List all manually installed packages on a debian/ubuntu system
#!/bin/bash
## List all manually installed packages on a debian/ubuntu system
## manually installed means:
## 1. not pre-installed with the system
## 2. not marked auto-installed by apt (not dependencies of other
## packages)
## Note: pre-installed packages that got updated still needs to be
## filtered out.
@pokstad
pokstad / gaereverseproxy.go
Last active October 24, 2021 09:35
Google App Engine reverse proxy in Golang
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// HTTP reverse proxy handler
package goengine
import (
"io"
@alanpeabody
alanpeabody / my_app.ex
Last active June 11, 2024 06:32
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])