Skip to content

Instantly share code, notes, and snippets.

Avatar

Rob Wells robjwells

View GitHub Profile
View ms-initial-setup.sh
set -euf -o pipefail
cd $HOME/Desktop/
rm -r 'imac-setup' || true
mkdir -p 'imac-setup'
cd 'imac-setup'
xcode-select --install || true
curl -s --show-error https://bootstrap.pypa.io/get-pip.py | sudo /usr/bin/python
@robjwells
robjwells / robjwells.css
Created Oct 6, 2015
The 2013-era CSS file for robjwells.com
View robjwells.css
/* robjwells.com
By Rob Wells, 2013
Contents
> Reset
> Font import
> Grids
> Wrapper
> FOUT hide
> Type
@robjwells
robjwells / css-mobile.diff
Last active Oct 6, 2015
Dr Drang's CSS file with media queries
View css-mobile.diff
--- mobile.css 2015-10-05 20:11:57.000000000 +0100
+++ drang-combined.css 2015-10-05 22:59:05.000000000 +0100
@@ -41,17 +41,12 @@
}
#container {
-/*
- width: 52em;
- min-width: 660px;
- */
@robjwells
robjwells / historical-dollars.py
Created Jul 15, 2015
Pythonista UI script that converts a dollar amount for a given year to current dollars
View historical-dollars.py
from __future__ import division
from datetime import date
from xml.etree import ElementTree
import requests
import ui
def calculate_amount(sender):
"""Convert given dollar amount for given year to current dollars"""
@robjwells
robjwells / NSAppleScript+RunHandler.h
Created Jul 5, 2015
NSAppleScript category to make calling AppleScript handlers (functions) easier
View NSAppleScript+RunHandler.h
//
// NSAppleScript+RunHandler.h
// astest
//
// Created by Rob Wells on 30/01/2014.
// Copyright (c) 2014 Rob Wells. All rights reserved.
//
#ifndef kASAppleScriptSuite
#define kASAppleScriptSuite 'ascr'
@robjwells
robjwells / phone_format.py
Last active Dec 5, 2016
Format UK phone number with area code
View phone_format.py
#!/usr/local/bin/python3
import re
import sys
area_codes = [
'020', '023', '024', '028', '029', '0113',
'0114', '0115', '0116', '0117', '0118', '0121',
'0131', '0141', '0151', '0161', '0191', '01200',
'01202', '01204', '01205', '01206', '01207', '01208',
View keybase.md

Keybase proof

I hereby claim:

  • I am robjwells on github.
  • I am robjwells (https://keybase.io/robjwells) on keybase.
  • I have a public key whose fingerprint is BF60 AE62 6723 EBC7 97CC 12A7 9E0A 4806 CFE9 E7D1

To claim this, I am signing this object:

@robjwells
robjwells / dayshift.py
Last active Jan 2, 2016
dayshift: get the date of the next or previous occurrence of a weekday
View dayshift.py
#!/usr/local/bin/python3
"""
Print the date of the next or last specified weekday.
Usage:
dayshift next <weekday> [--format=<fmt> --inline]
dayshift last <weekday> [--format=<fmt> --inline]
Options:
--format=<fmt>, -f <fmt> A strftime format string
@robjwells
robjwells / 24_to_12.py
Last active Dec 29, 2015
Convert 24-hour time to formatted 12-hour time
View 24_to_12.py
#!/usr/local/bin/python3
import sys
import re
input_text = sys.stdin.read()
regex_24 = re.compile(r'''\b
([01][0-9]|2[0-3]) # Hour (00-23)
([0-5][0-9]) # Mins (00-59)
\b''', flags=re.VERBOSE)
@robjwells
robjwells / copy_diff.py
Created Oct 17, 2013
copy_diff - Compare two sections of the same file See http://robjwells.com/post/61132555301/solo-diff
View copy_diff.py
#!/usr/bin/env python3
import os
import re
import subprocess
os.chdir('/tmp')
with open(os.environ['BB_DOC_PATH']) as full_file:
sub_copy, orig_copy = re.split(r'#{2,} original copy #{2,}',
full_file.read(), flags=re.I)