Skip to content

Instantly share code, notes, and snippets.

@nyergler
nyergler / letter-threads.py
Created Oct 30, 2018
Multithreading with Lob's Python client & Python 3
View letter-threads.py
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
My Hammerspoon window management configuration
View init.lua
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 Jul 5, 2015
Whitespace like a civilized person
View whitespace.el
;; 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)
View 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:

View message.py
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 Apr 10, 2014
A string subclass that stores an encoding, easing interoperability between byte strings and Unicode strings.
View encodedstring.py
"""
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 Sep 11, 2013
Use mock.patch to inspect calls to a method under test.
View methodinspector.py
import collections
from mock import patch
MethodCall = collections.namedtuple(
'MethodCall',
('args',
'kwargs',
'return_value',
),
@nyergler
nyergler / kenobi.el
Created Jul 28, 2013
Personal Emacs configuration for detecting virtual environments, adding egg directories, and allowing extra paths to be added to the Jedi auto-completion server.
View kenobi.el
(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 Jan 31, 2012
Convert maildirs (including subfolders) to mbox format
View maildir2mbox.py
#!/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.