Skip to content

Instantly share code, notes, and snippets.

View mattbillenstein's full-sized avatar

Matt Billenstein mattbillenstein

View GitHub Profile
@mattbillenstein
mattbillenstein / cron.py
Created April 29, 2011 17:58
A simple cron job parser...
#!/usr/bin/env python
import sys
import datetime
class cronjob(object):
def __init__(self, line):
self.process_line(line)
def process_line(self, line):
@mattbillenstein
mattbillenstein / gist:1052184
Created June 28, 2011 20:57
First Linux kernel patch
`From 2d32f746223bfd89994edc0d16716e90e7836e74 Mon Sep 17 00:00:00 2001
From: Matt Billenstein <[email protected]>
Date: Wed, 1 Jun 2011 09:17:06 +0000
Subject: staging: comedi (adv_pci1723): coding style, fix whitespace before
quoted newline
Small fix in adv_pci1723.c for a "whitespace before quoted newline" warning
from checkpatch.pl
Signed-off-by: Matt Billenstein <[email protected]>
@mattbillenstein
mattbillenstein / s3put
Created December 13, 2011 10:02
boto parallel s3 upload script
#!/usr/bin/env python
import gevent.monkey
gevent.monkey.patch_all()
import boto
import config
import gevent
import gevent.pool
import os
#!/usr/bin/env python
import sys
import zlib
import bz2
BLOCK_SIZE = 1024*1024
def main():
size = 0
@mattbillenstein
mattbillenstein / gist:6216454
Created August 12, 2013 23:42
bmemcached creates a new server connection on every request
mattb@mattb-mitx:~ $ sudo /etc/init.d/memcached restart
Restarting memcached: memcached.
mattb@mattb-mitx:~ $ cat test_bmemcached.py
#!/usr/bin/env python
import bmemcached
import time
c = bmemcached.Client()
@mattbillenstein
mattbillenstein / gist:6981183
Created October 14, 2013 19:54
gnuplot a csv...
mattb@mattb-mbp:~ $ head infile.csv
elapsed,spent,price
0.127883,0.115402,6.552
0.128115,0.115402,7.207
0.128346,0.116246,7.927
0.128578,0.116246,8.719
0.128809,0.118902,8.806
0.129041,0.119576,8.894
0.129272,0.120159,8.982
0.129504,0.120817,9.071
@mattbillenstein
mattbillenstein / gist:7baa1d0d006cf6981942
Last active May 23, 2016 12:08
gevent streamer thingy
#!/usr/bin/env python
import gevent.monkey
gevent.monkey.patch_all()
import gevent
import random
import time
from gevent.event import Event
#!/usr/bin/env python2
import graphene
import logging
logging.basicConfig(level=logging.ERROR)
logger = logging.getLogger()
logger.addHandler(logging.StreamHandler())
class Tea(graphene.ObjectType):
> db.yt_video_ts3.find()
{ "_id" : ObjectId("57682e87ced89007a1aa9f71"), "id" : "---0savA9eY", "ts" : ISODate("2016-06-03T02:35:39.049Z"), "v" : { "viewCount" : 2016, "likeCount" : 1, "commentCount" : 2 } }
{ "_id" : ObjectId("57682e87ced89007a1aa9f72"), "id" : "---0savA9eY", "ts" : ISODate("2016-06-05T14:27:29.732Z"), "v" : { "viewCount" : 2017, "likeCount" : 1, "commentCount" : 2 } }
{ "_id" : ObjectId("57682e87ced89007a1aa9f73"), "id" : "---8lKLb9gI", "ts" : ISODate("2016-06-08T03:44:39.079Z"), "v" : { "viewCount" : 2 } }
{ "_id" : ObjectId("57682e87ced89007a1aa9f74"), "id" : "---9l91bzWg", "ts" : ISODate("2016-06-08T03:51:07.494Z"), "v" : { "viewCount" : 34, "likeCount" : 1 } }
{ "_id" : ObjectId("57682e87ced89007a1aa9f75"), "id" : "---AwsK8TGg", "ts" : ISODate("2016-06-03T02:30:22.917Z"), "v" : { "viewCount" : 764, "likeCount" : 23, "commentCount" : 1 } }
{ "_id" : ObjectId("57682e87ced89007a1aa9f76"), "id" : "---AwsK8TGg", "ts" : ISODate("2016-06-04T02:27:58.404Z"), "v" : { "viewCount" : 766, "likeCount
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on vazor.com
X-Spam-Flag: YES
X-Spam-Level: ******
X-Spam-Status: Yes, score=6.6 required=6.0 tests=FREEMAIL_FORGED_REPLYTO,
HTML_IMAGE_ONLY_32,HTML_MESSAGE,LONG_IMG_URI,MIME_HTML_ONLY,T_DKIM_INVALID