Skip to content

Instantly share code, notes, and snippets.

directionless /
Created February 28, 2014 20:57

Keybase proof

I hereby claim:

  • I am directionless on github.
  • I am seph ( on keybase.
  • I have a public key whose fingerprint is 862F 624E 4D89 D0DD 5826 E89C 2590 35C7 4ACB 4497

To claim this, I am signing this object:

directionless / output
Created July 30, 2014 06:59
Testing string conversion performance in python
View output
Wed Jul 30 02:58:53 2014 /tmp/python.string.stats
2100004 function calls in 1.436 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
300000 0.500 0.000 0.529 0.000
1 0.278 0.278 1.436 1.436
300000 0.154 0.000 0.683 0.000
directionless / import test
Created August 14, 2014 02:09
Python WTF
View import test
import random
import cProfile
import pstats
import math
from math import cos, sin, pi
def TESToverhead(a):
# This is just to check the call overhead
directionless / octocat pagination
Created December 23, 2014 17:35
Octocat pagination
View octocat pagination
# WTF Octocat. This should be cleaner.
members = client.org_members(ORGNAME)
next_url = client.last_response.rels[:next]
while ! next_url.nil? do
page = next_url.href.gsub(/.*page=(\d+)/,'\1')
puts "Fetching page #{page}"
members.concat client.org_members(ORGNAME, :page => page)
next_url = client.last_response.rels[:next]
directionless /
Last active August 29, 2015 14:12 — forked from kayahr/
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#First released as C++ program by Hiroyuki Tsutsumi as part of the free software suite "Beer"
#I thought porting it to Python could be both a challenge and useful
from sys import argv, exit, getsizeof
from struct import pack_into, unpack_from
def ceil4(n):
View gist:caeb0fc7c97f230aa57a
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define CANARY "in_the_coal_mine"
struct {
char buffer[1024];
directionless / gist:cc561241acfeee98020d
Created May 12, 2015 17:16
Python describing functions
View gist:cc561241acfeee98020d
class TestClass(object):
STRINGS["func1"] = lambda t: "func1 {0}".format(t)
def func1(self, t):
return "I did func1"
STRINGS["func2"] = lambda t: "func2 {0}".format(t)
def func2(self, t):
return "I did func2"
directionless / firefox.txt
Created May 13, 2015 15:28
Simple python server
View firefox.txt
<__main__.RequestHandler instance at 0x104e677a0>
['MessageClass', '__doc__', '__init__', '__module__', 'address_string', 'client_address', 'close_connection', 'command', 'connection', 'date_time_string', 'default_request_version', 'disable_nagle_algorithm', 'do_GET', 'do_POST', 'end_headers', 'error_content_type', 'error_message_format', 'finish', 'handle', 'handle_one_request', 'headers', 'log_date_time_string', 'log_error', 'log_message', 'log_request', 'monthname', 'parse_request', 'path', 'protocol_version', 'raw_requestline', 'rbufsize', 'request', 'request_version', 'requestline', 'responses', 'rfile', 'send_error', 'send_header', 'send_response', 'server', 'server_version', 'setup', 'sys_version', 'timeout', 'version_string', 'wbufsize', 'weekdayname', 'wfile'] - - [13/May/2015 11:28:17] "GET / HTTP/1.1" 200 -
View s3-put.rb
# Note that this takes about 100 minutes to run.
require 'rubygems'
require 'aws/s3'
directionless / webrat-test.rb
Created December 30, 2010 04:13
Testing webrat and = in form values
View webrat-test.rb
# for
require 'webrat'
require 'webrat/adapters/mechanize'
include Webrat::Methods
Webrat.configure do |config|