Skip to content

Instantly share code, notes, and snippets.

@chrismatthieu
chrismatthieu / gist:992261
Created May 25, 2011 23:57
If you ever need to remove files from your GitHub repo's history, here's how to do it:
1. add all of the files you want to hide to .gitignore
2. git commit -a -m "removed files"
3. git filter-branch
4. git push origin master -f
@hugs
hugs / im_here_for_an_argument.txt
Created August 10, 2011 22:48
Introspecting a Python function's arguments
How to get the args of a function in Python:
# "Regular" arguments:
>>> import inspect
>>> def spam(a, b, c=3): pass
...
>>> inspect.getargspec(spam)
ArgSpec(args=['a', 'b', 'c'], varargs=None, keywords=None, defaults=(3,))
@cowboy
cowboy / do_this_stuff.sh
Created November 30, 2011 16:21
Install Znc 0.202 in Ubuntu 11.04 (apt-get installs 0.092 by default)
# IIRC, this is what I had to do to install Znc 0.202 in Ubuntu 11.04:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:trekcaptainusa-tw/backports
sudo apt-get update
sudo apt-get install znc
# Don't forget to open the port in iptables. And while this opens the port, it
# won't restore the settings upon next boot. You'll want to use iptables-save
# for that, like: iptables-save > /etc/iptables.rules (this depends on your setup)
sudo iptables -A INPUT -p tcp -m tcp --dport 8000 -j ACCEPT
@voidfiles
voidfiles / textrank.py
Created January 20, 2012 08:22
An implmentation of TextRank in python
"""
From this paper: http://acl.ldc.upenn.edu/acl2004/emnlp/pdf/Mihalcea.pdf
I used python with nltk, and pygraph to do an implmentation of of textrank.
for questions: http://twitter.com/voidfiles
"""
import nltk
import itertools
@jboner
jboner / latency.txt
Last active April 24, 2024 13:53
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@arvearve
arvearve / gist:4158578
Created November 28, 2012 02:01
Mathematics: What do grad students in math do all day?

Mathematics: What do grad students in math do all day?

by Yasha Berchenko-Kogan

A lot of math grad school is reading books and papers and trying to understand what's going on. The difficulty is that reading math is not like reading a mystery thriller, and it's not even like reading a history book or a New York Times article.

The main issue is that, by the time you get to the frontiers of math, the words to describe the concepts don't really exist yet. Communicating these ideas is a bit like trying to explain a vacuum cleaner to someone who has never seen one, except you're only allowed to use words that are four letters long or shorter.

What can you say?

@akuhn
akuhn / icse2013-preprint.md
Created November 29, 2012 23:19
Preprints of ICSE 2013 papers

Preprints of ICSE 2013 papers

Found 21 preprints so far of the 85 papers listed here, http://2013.icse-conferences.org/content/accepted-papers-technical-research-track (most recent additions first)

If yours is missing, tweet or email me! The same if you find a false positive.

What Good Are Strong Specifications? Nadia Polikarpova, Carlo A. Furia, Yu Pei, Yi Wei, and Bertrand Meyer (ETH Zurich, Switzerland)

@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@ttscoff
ttscoff / editor.sh
Last active May 24, 2017 17:46
A replacement EDITOR variable for using different editors based on filetypes
#!/bin/bash
case "$1" in
*_EDITMSG|*MERGE_MSG|*_TAGMSG )
/usr/local/bin/vim "$1"
;;
*.md )
/usr/local/bin/mmdc "$1"
;;
*.txt )
# 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):