This file contains hidden or 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 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 |
This file contains hidden or 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
| import cffi | |
| ffi = cffi.FFI() | |
| ffi.cdef(''' | |
| struct bad_struct { | |
| uint64_t bad_uint64[2]; | |
| }; |
This file contains hidden or 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
| 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) |
This file contains hidden or 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
| 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) |
This file contains hidden or 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 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'), |
This file contains hidden or 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
| static void | |
| bstack(Monitor *m) { | |
| int w, h, mh, mx, tx, ty, tw; | |
| unsigned int i, n; | |
| Client *c; | |
| for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); | |
| if(n == 0) | |
| return; | |
| if(n > m->nmaster) { |
This file contains hidden or 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
| import os | |
| import io | |
| FN = 'thefile' | |
| with open(FN, 'w') as f: | |
| f.write(b'abcdefgh\n' | |
| b'ijlkmnop\n' | |
| b'qrstuwxyz\n') |
This file contains hidden or 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
| (defun python-swap-quotes () | |
| (interactive) | |
| (save-excursion | |
| (let ((state (syntax-ppss))) | |
| (when (eq 'string (syntax-ppss-context state)) | |
| (let* ((left (nth 8 state)) | |
| (right (1- (scan-sexps left 1))) | |
| (newquote (if (= ?' (char-after left)) | |
| ?\" ?'))) | |
| (dolist (loc (list left right)) |
This file contains hidden or 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
| import argparse | |
| import parsley | |
| def make_argparser(reqs): | |
| argparser = argparse.ArgumentParser() | |
| for req in reqs: | |
| argparser.add_argument('--' + req) | |
| return argparser |
This file contains hidden or 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
| import argparse | |
| import parsley | |
| def make_argparser(reqs): | |
| argparser = argparse.ArgumentParser() | |
| for req in reqs: | |
| argparser.add_argument('--' + req) | |
| return argparser |