Skip to content

Instantly share code, notes, and snippets.

View haldean's full-sized avatar

Haldean Brown haldean

View GitHub Profile

Keybase proof

I hereby claim:

  • I am haldean on github.
  • I am haldean (https://keybase.io/haldean) on keybase.
  • I have a public key whose fingerprint is 4A2C BD0B 77C0 A155 070E A699 0458 5657 D9FC 9B89

To claim this, I am signing this object:

"""
Most useful as:
git ls-tree --name-only -r HEAD | xargs python /path/to/authordensity.py
When run from the root of your git repository. If people show up under
multiple names, use the synonyms dict to map their aliases to a canonical
name.
Needs no external libs.
@haldean
haldean / client.c
Created September 24, 2015 18:18
Benny's thing
#define _WRAPPER_NAME bfs
#include "generate_wrapper.h"
/* use RequstWrapper in here */
@haldean
haldean / gist:89a13ae3cc65638a3e5d
Created May 3, 2015 18:30
OpenBSD malloc gist
Allocation of a zero size object returns a pointer to a zero size object.
This zero size object is access protected, so any access to it will
generate an exception (SIGSEGV). Many zero-sized objects can be placed
consecutively in shared protected pages. The minimum size of the
protection on each object is suitably aligned and sized as previously
stated, but the protection may extend further depending on where in a
protected zone the object lands.
@haldean
haldean / yantoo.py
Last active January 2, 2016 01:58
yantoo
#!/usr/bin/env python
import praw
import pickle
import time
COMMENT_TEXT = '''
[You are never the only one.](http://youarenevertheonlyone.com)
'''.strip()
@haldean
haldean / gist:4266111
Created December 12, 2012 08:32
A quick shell function to suppress all output from a command.
# Add this to your .bashrc (or .zshrc, .profile, etc.),
# then call noisy commands using "silent noisy_command".
# Especially useful for things like "silent firefox &".
function silent {
$@ >/dev/null 2>/dev/null
}
@haldean
haldean / gist:3046322
Created July 4, 2012 09:23
pythonpackages error on login
Internal Server Error
Traceback (most recent call last):
File "/app/.heroku/venv/lib/python2.7/site-packages/waitress/channel.py", line 329, in service
task.service()
File "/app/.heroku/venv/lib/python2.7/site-packages/waitress/task.py", line 173, in service
self.execute()
File "/app/.heroku/venv/lib/python2.7/site-packages/waitress/task.py", line 380, in execute
app_iter = self.channel.server.application(env, start_response)
File "/app/.heroku/venv/lib/python2.7/site-packages/newrelic-1.2.1.265/newrelic/api/web_transaction.py", line 490, in __call__
@haldean
haldean / Main.js
Created June 23, 2012 16:55
Output from Haste for Main.hs
/* Eval
Evaluate the given thunk t into head normal form.
If the "thunk" we get isn't actually a thunk, just return it.
*/
function E(t) {
if(t instanceof Thunk) {
if(t.f) {
t.x = t.f();
t.f = 0;
}
@haldean
haldean / astrofinal.tex
Created April 11, 2012 23:07
Sample Latex file
\input{latex_template.tex}
\title{Astrophysics Final Exam}
\begin{document}
\maketitle
\section{Helium-burning stars}
\begin{enumerate}
\item To find the energy liberated in the reaction, we must find the mass lost
in the reaction, then use $E=mc^2$ to find the equivalent quantity of energy
released.
@haldean
haldean / gist:1998932
Created March 8, 2012 05:35
Mesh generation with memory error
- (Mesh)generateMesh {
int numRings = [spine count];
/* Triangles in the cylinder */
int triCount = 2 * (numRings - 1) * SEGMENTS_IN_CIRCLE;
/* Triangles in flat end cap (m - 2 triangles required for an m-gon) */
triCount += 2 * SEGMENTS_IN_CIRCLE - 4;
Mesh* result = (Mesh*) malloc(sizeof(Mesh));
/* 3 verteces for each triangle */