Skip to content

Instantly share code, notes, and snippets.

View markrwilliams's full-sized avatar

Mark Williams markrwilliams

View GitHub Profile
from datetime import datetime
from collections import namedtuple
ANY = '*'
class JobTime(namedtuple('JobTime', ['minute', 'hour',
'day_of_month',
'month', 'day_of_week'])):
_field_to_datetime = [('month', 'month'),
import ctypes
libc = ctypes.CDLL('libc.so.6')
def libc_version():
# 2 appears to be _CS_GNU_LIBC_VERSION
length = libc.confstr(2, None, 0)
version = ctypes.create_string_buffer(length)
assert length == libc.confstr(2, ctypes.byref(version), length)
def nwise(iterable, n):
tees = itertools.tee(iterable, n)
for i, t in enumerate(tees):
for _ in xrange(i):
next(t)
return itertools.izip(*tees)
import cffi
ffi = cffi.FFI()
ffi.cdef('''
struct bad_struct {
uint64_t bad_uint64[2];
};
from spyce import (Rights, CAP_READ, CAP_LOOKUP, CAP_SEEK, CAP_MMAP,
CAP_FSTAT, CAP_MMAP_RX, enterCapabilityMode)
import imp
import re
import cffi
import ctypes
import os
import sys
from fsnix import fs
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
static void lookup()
{
# # emacs keybindings for navigation in copy mode
# markkeys ^B=Y:^F=V:h=^B:l=^F:0=^A:$=^E
# # C-space sets mark. markkeys does it in screen 4.0 and higher, but 3.9x
# # needs the bindkey command. (note the ^@ escape sequence for C-space.)
# markkeys ' '=^@
# # bindkey -m ^@ stuff ' '
# # page up and page down
# bindkey -m -k kP stuff Y
from threading import RLock
class T(object):
def __init__(self):
self.lock = RLock()
def _meth(self):
pass
import sys
from threading import Thread
from time import time
from Queue import Queue
def f(a):
return a

Keybase proof

I hereby claim:

  • I am markrwilliams on github.
  • I am markrwilliams (https://keybase.io/markrwilliams) on keybase.
  • I have a public key ASAc0PYz8kM8wGLX9sAxx2RzeFky9nyHgSlFYMQ81pTgOQo

To claim this, I am signing this object: