Navigation Menu

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
timbaileyjones / README.md
Created January 3, 2024 03:10 — forked from keidrun/README.md
How to marshal and unmarshal sql.Null types to JSON in golang

Answer

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

@timbaileyjones
timbaileyjones / svn-rename-spaces-to-underscore.py
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 https://gist.github.com/kranthilakum/7536042, which renames only immediate files, via os.rename(). Hope it helps someone…
#!/usr/bin/python
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:
namespace: min-ec2
environments:
- name: acceptance
provider: ec2
- name: production
provider: ec2
@timbaileyjones
timbaileyjones / flatten.py
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)
else:
list = list.append(input)
return list