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 / flatten.py
Created May 9, 2017 16:57
Example of a unit test for a list-flattening function
View flatten.py
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
View mu-environment-fragment
namespace: min-ec2
environments:
- name: acceptance
provider: ec2
- name: production
provider: ec2
@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…
View svn-rename-spaces-to-underscore.py
#!/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: