Skip to content

Instantly share code, notes, and snippets.

View garethsenior's full-sized avatar

Gareth Senior garethsenior

  • Sainsbury's
  • London
View GitHub Profile
@garethsenior
garethsenior / strip_parentheses.py
Last active March 8, 2017 14:45
Strip Parentheses
import unittest
def strip_parentheses(input, chars="()"):
"""
Strips bracketed clauses from text strings
Just returns the string if it finds incorrect nesting
Whitespace will remain untouched.
"""
open_char = chars[0]
@garethsenior
garethsenior / trim.csv
Created March 7, 2017 09:40
Trim GZipped CSV
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 6.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import gzip
import os
"""
Usage:
trim.csv <output-dir> <filename_filter> <search pattern>
trim.csv processed .csv.gz ,8088,

Keybase proof

I hereby claim:

  • I am garethsenior on github.
  • I am g_s (https://keybase.io/g_s) on keybase.
  • I have a public key whose fingerprint is 092A 3484 2BD4 8FB3 CF5D 9075 1776 6FB9 7D16 5951

To claim this, I am signing this object: