This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#this is mostly from: | |
#http://code.activestate.com/recipes/577187-python-thread-pool/ | |
from Queue import Queue | |
from threading import Thread, Event | |
from sys import stdout, stderr | |
from time import sleep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import json | |
import requests | |
from functools import partial | |
import pprint | |
import calendar | |
import time | |
issue_parameters = set(['title', 'body', 'milestone', 'labels', 'assignees', 'state']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* build with: g++ -std=c++11 -O2 mem_map_tar.cpp -o list_tar | |
* run as: ./list_tar some_file.tar | |
*/ | |
#include <unordered_map> | |
#include <string> | |
#include <utility> | |
#include <cmath> | |
#include <cstring> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <fstream> | |
#include <streambuf> | |
#include <iostream> | |
int main(int argc, char** argv) { | |
if(argc < 2) { | |
std::cerr << "cat: Pass me a file\n"; | |
return 2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#run this like: DAYS=365 ./code_timeline.sh https://github.com/org/repo1.git https://github.com/org/repo2.git | |
#note that the types of files it checks for code are hardcoded below | |
code='\.cc$|\.h$|\.cpp$|\.hpp$|\.lua$|\.py$|\.js' | |
: ${DAYS:?Please set DAYS environment variable to a number of days in the past youd like to capture} | |
#setup each repo | |
echo -n "day," | |
for url in ${@}; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cinttypes> | |
#include <limits> | |
//combining a union with an anonymous bit field we can: | |
// get a summary value for the entire bit field | |
// reference bit field members directly from the union | |
// use an initializer list to set them | |
//TODO: how to initialize via the bit field members without un-anonymizing it | |
union bit_funion_t { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <iostream> | |
template <class T> | |
struct iterable_t { | |
public: | |
using iterator = T*; | |
iterable_t(T* first, size_t size): head(first), tail(first + size), count(size){} | |
iterable_t(T* first, T* end): head(first), tail(end), count(end - first){} | |
T* begin() { return head; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <list> | |
#include <vector> | |
//the guts that both specializations can use | |
template <class container_t> | |
void fill(container_t& c, int start, int end) { | |
for(;start <= end; ++start) | |
c.push_back(start); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from BaseHTTPServer import BaseHTTPRequestHandler | |
from StringIO import StringIO | |
from cgi import urlparse | |
import json | |
import zmq | |
class HTTPRequest(BaseHTTPRequestHandler): | |
def __init__(self, request_text): | |
self.rfile = StringIO(request_text) | |
self.raw_requestline = self.rfile.readline() |