Skip to content

Instantly share code, notes, and snippets.

View brettlangdon's full-sized avatar

Brett Langdon brettlangdon

View GitHub Profile

Assume we have a file class with a single method called write, which persists bytes to disk:

f = File('/tmp/my/file.txt') f.write("hello world")

b = Buffer(f, bytes=1000) b.write("hello world") b.flush() Write a wrapper class for the file object which allows us to buffer the writes in-memory. The data should be flushed to disk when the buffer is full, or on demand with a method called flush. It should not use more memory than the max bytes allowed.

@brettlangdon
brettlangdon / # python - 2018-06-19_15-47-02.txt
Created June 19, 2018 19:49
python on macOS 10.14 - Homebrew build logs
Homebrew build logs for python on macOS 10.14
Build date: 2018-06-19 15:47:02
@brettlangdon
brettlangdon / example.py
Created October 15, 2015 20:30
Human friendly octal file modes
import os
import stat
import mode
passwd_stat = os.stat('/etc/passwd')
passwd_mode = stat.S_IMODE(passwd_stat.st_mode)
print passwd_mode
# 420
print passwd_mode == (mode.USER_RW | mode.GROUP_R | mode.OTHER_NONE)

Wallpapers

Install with git git clone https://gist.github.com/85942af486eb79118467.git ~/Pictures/wallpapers

@brettlangdon
brettlangdon / keybase.md
Created September 22, 2014 14:30
keybase.md

Keybase proof

I hereby claim:

  • I am brettlangdon on github.
  • I am brettlangdon (https://keybase.io/brettlangdon) on keybase.
  • I have a public key whose fingerprint is 1A42 C239 3A3D 1530 4459 50BA 3DD5 C622 BE1A 97AA

To claim this, I am signing this object:

#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected])
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
/* @license
* jQuery ShapeJS Plugin
* version: 2.1.0-2014.02.04
* Requires jQuery v1.5 or later
* Copyright (c) 2014 Shapeways
* Examples and documentation at: http://shapejs.shapeways.com
* Project repository: https://github.com/Shapeways/shapejs
* License: MIT
*/
var executeShapeJs = function(script, params, success, failure){