Skip to content

Instantly share code, notes, and snippets.

View timbaileyjones's full-sized avatar
Working from home

Tim Bailey-Jones timbaileyjones

Working from home
View GitHub Profile
timbaileyjones /
Created May 9, 2017 16:57
Example of a unit test for a list-flattening function
import types
import unittest
def flatten(input, list=[]):
if isinstance(input, types.ListType):
for item in input:
flatten(item, list)
list = list.append(input)
return list
namespace: min-ec2
- name: acceptance
provider: ec2
- name: production
provider: ec2
timbaileyjones /
Last active June 17, 2021 15:04
Quick python script to rename directories AND files (recursively) in SVN repositories that have spaces in them. So next time somebody checks in a file pile containing spaces, I run this, and commit. End of problem. Inspired by, which renames only immediate files, via os.rename(). Hope it helps someone…
import os
import sys
import time
import subprocess
def space2_(directory):
for filename in os.listdir(directory): # parse through file list in the current directory
#print "checking %s" % filename
if filename.find(".svn") >= 0:
timbaileyjones /
Created January 3, 2024 03:10 — forked from keidrun/
How to marshal and unmarshal sql.Null types to JSON in golang


Use custom nullable types instead of original sql.Null types like sql.NullBool, sql.NullFloat64, sql.NullInt64 or sql.NullString.