Skip to content

Instantly share code, notes, and snippets.

Justine Tunney jart

Block or report user

Report or block jart

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View select.py
import select
import socket
class UDPEchoServer(object):
def __init__(self):
self.sock = socket.socket(type=socket.SOCK_DGRAM)
self.sock.bind(('0.0.0.0', 5000))
@jart
jart / pbkdf2.c
Created Sep 13, 2011
Justine's PBKDF2
View pbkdf2.c
/* gcc -O3 --std=gnu99 -o pbkdf2 pbkdf2.c sha256.c && time ./pbkdf2 password salt 100000 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "sha256.h"
#define DIGEST_SIZE 32
#define BLOCK_SIZE 64
@jart
jart / gist:3156709
Created Jul 21, 2012
Assembly Audio Mixing
View gist:3156709
/**
* Represents 20ms of 8khz signed linear 16-bit audio
*
* This is how much audio gets put in each RTP packet.
*/
typedef int16_t frame_t[160];
/**
* Fast mix two audio frames together on x86 and x86_64
*
@jart
jart / gist:3432942
Created Aug 23, 2012
Generated Poetry
View gist:3432942
-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-
IAMBIC PENTAMETER COUPLETS GOTH CORPUS
-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-
we really have to plug my eyes before
black angel i feel hunger for the shore
which answered not with a caress he died
shone for me to the lake of the night tide
with sadness here i opened wide the door
that scream i hear the angels name lenore
@jart
jart / gotham.py
Created Aug 23, 2012
Gothic Poetry Generator
View gotham.py
r"""
gotham
~~~~~~
Gothic Poetry Generator
"""
import sys
@jart
jart / gotham.py
Created Aug 24, 2012
Lorem Gotham w/ Rhyming
View gotham.py
r"""
gotham
~~~~~~
Gothic Poetry Generator
"""
import marshal
@jart
jart / form_errors.html
Last active Dec 11, 2015
An example of how to use Twitter Bootstrap with Django Forms
View form_errors.html
{% for error in form.non_field_errors %}
<div class="alert alert-error">{{ error }}</div>
{% endfor %}
@jart
jart / euler.py
Last active Mar 19, 2016
These are the Project Euler solutions I wrote to sharpen my coding skills when I was preparing for my Google interviews. I don't have a strong background in math. So sometimes you'll notice I just kludge things and treat numbers as strings.
View euler.py
# problem 1
# add all natural numbers below one thousand that are multiples of 3 or 5.
print sum(n for n in xrange(1, 1000) if n % 3 == 0 or n % 5 == 0)
# problem 2
# sum of even value fibs below four million
def fib():
yield 1
yield 1
a, b = 1, 1
@jart
jart / gist:4704095
Created Feb 3, 2013
Google Open Source Libraries for C++ Development
View gist:4704095
* http://google-opensource.blogspot.com/
* http://blog.0x1fff.com/2009/12/35-google-open-source-projects-that-you.html
* glog - An excellent C++ logging library.
* gtest - An excellent C++ testing library.
* gflags - The best way to make your C++ program accept command line flags, be documented, and configurable all in one fell swoop.
* breakpad - A good multi-platform crash reporting system for C++ apps.
* gperftools - Faster heap memory and a bunch of tools similar to valgrind. Not as well maintained as it should be.
* sparsehash - An awesome hash map container library for both performance and low memory use cases.
* cityhash - Perhaps the best non-crypto hashing algorithm. 2x faster than MurmurHash.
* re2 - A drop-in replacement for PCRE (Perl Compatible Regular Expressions) that doesn't introduce security and performance risks. Most other regex libraries will run potentially boundless operations which can have surprising performance impacts and allow attackers to perform denial of service attacks.
@jart
jart / motd
Created Sep 28, 2013 — forked from anonymous/motd
View motd
                                                                       
                                                                         
                                                                            
                                                                              
                                         [48;5;237
You can’t perform that action at this time.