Skip to content

Instantly share code, notes, and snippets.

@jmemich
jmemich / things.txt
Created September 24, 2015 00:22
stuff for ian
import os
from setuptools import find_packages, setup
## setup.py
def main():
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as _in:
return _in.read()
setup(
@jmemich
jmemich / dynamicFactoryClass.py
Last active June 28, 2023 19:56
Dynamic Inheritance Factory Class
class Database(object):
def _print(self):
print('Database class')
class Local(object):
def _print(self):
print('Local class')
class BaseThing(object):
def __init__(self):
@jmemich
jmemich / mutability_ex.py
Last active September 7, 2015 11:39
Quick n easy example of mutability mess
class MutableClass():
def __init__(self):
self.thing = [] # mutable
self.nonething = None
def fn(self, new):
self.thing.append(new)
self.nonething = new
m, m2 = MutableClass(), MutableClass()
@jmemich
jmemich / mock_ex.py
Created June 17, 2015 19:16
mock test example
# https://docs.python.org/3/library/unittest.mock.html
from unittest.mock import MagicMock, Mock
from nose.tools import assert_equal, raises, assert_true, assert_raises
class A():
def __init__(self):
self.item = 'item'
def return_item(self, thing = None):
if not thing:

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: