Skip to content

Instantly share code, notes, and snippets.

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 October 6, 2015 00:13
The 2013-era CSS file for robjwells.com
/* robjwells.com
By Rob Wells, 2013
Contents
> Reset
> Font import
> Grids
> Wrapper
> FOUT hide
> Type
@robjwells
robjwells / css-mobile.diff
Last active October 6, 2015 01:04
Dr Drang's CSS file with media queries
--- 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 July 15, 2015 22:18
Pythonista UI script that converts a dollar amount for a given year to current dollars
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 July 5, 2015 14:46
NSAppleScript category to make calling AppleScript handlers (functions) easier
//
// 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 December 5, 2016 14:26
Format UK phone number with area code
#!/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',

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 January 2, 2016 22:29
dayshift: get the date of the next or previous occurrence of a weekday
#!/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 December 29, 2015 17:29
Convert 24-hour time to formatted 12-hour time
#!/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 October 17, 2013 08:29
copy_diff - Compare two sections of the same file See http://robjwells.com/post/61132555301/solo-diff
#!/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)