Skip to content

Instantly share code, notes, and snippets.

@nyergler
nyergler / letter-threads.py
Created October 30, 2018 23:40
Multithreading with Lob's Python client & Python 3
import concurrent.futures
import urllib.request
import lob
lob.api_key = 'XXX'
MAX_CONCURRENCY = 5
FROM_ADDRESS = {
'name': 'Larry Lobster',
'address_line1': '185 Berry St #6100',
@nyergler
nyergler / init.lua
Created May 21, 2018 15:57
My Hammerspoon window management configuration
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "W", function()
hs.alert.show(
"Hello World!",
{
textFont= "Comic Sans MS",
textSize=72,
fadeOutDuration=1
}
)
end)
@nyergler
nyergler / whitespace.el
Created July 5, 2015 17:57
Whitespace like a civilized person
;; whitespace mode configuration
(require 'whitespace)
; make whitespace-mode use just basic coloring
(setq whitespace-style (quote
(spaces tabs newline tab-mark newline-mark face lines-tail)))
(setq show-trailing-whitespace 't)
(global-whitespace-mode 't)
@nyergler
nyergler / keybase.md
Created September 28, 2014 05:33
keybase.md

Keybase proof

I hereby claim:

  • I am nyergler on github.
  • I am nyergler (https://keybase.io/nyergler) on keybase.
  • I have a public key whose fingerprint is 0C97 9219 A0B4 3AC4 A899 19C9 9861 12D1 5DE3 52C4

To claim this, I am signing this object:

class Twilio(object):
def send(self, message, to):
print "SMS '" + message + "' sent to " + to
class Email(object):
def send(self, message, to):
print "Email '" + message + "' sent to " + to
@nyergler
nyergler / encodedstring.py
Created April 10, 2014 15:30
A string subclass that stores an encoding, easing interoperability between byte strings and Unicode strings.
"""
Copyright (c) 2012-2014, Eventbrite and Contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
@nyergler
nyergler / methodinspector.py
Created September 11, 2013 23:11
Use mock.patch to inspect calls to a method under test.
import collections
from mock import patch
MethodCall = collections.namedtuple(
'MethodCall',
('args',
'kwargs',
'return_value',
),
@nyergler
nyergler / kenobi.el
Created July 28, 2013 20:31
Personal Emacs configuration for detecting virtual environments, adding egg directories, and allowing extra paths to be added to the Jedi auto-completion server.
(add-hook 'hack-local-variables-hook 'run-local-vars-mode-hook)
(defun run-local-vars-mode-hook ()
"Run a hook for the major-mode after the local variables have been processed."
(run-hooks (intern (concat (symbol-name major-mode) "-local-vars-hook"))))
(defun detect_buffer_venv (buffer-name)
(let ((buffer-dir (file-name-directory buffer-name)))
@nyergler
nyergler / maildir2mbox.py
Created January 31, 2012 05:39
Convert maildirs (including subfolders) to mbox format
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Frédéric Grosshans, 19 January 2012
Nathan R. Yergler, 6 June 2010
This file does not contain sufficient creative expression to invoke
assertion of copyright. No warranty is expressed or implied; use at
your own risk.