This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
command -v jq >/dev/null 2>&1 || { | |
echo >&2 "ERROR: jq is not installed. This is required for parsing json responses."; exit 1; | |
} | |
if [ $(id -u) != 0 ] || [ ! -w /etc ]; then | |
echo "ERROR: Requires root privileges (or write permissions to /etc). Try again with sudo." | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Download information about approximately 38,000 trees in Belfast (N. Ireland) from | |
the opendatani.gov.uk data api and convert from JSON to CSV. | |
Usage:: | |
$ python get_belfast_trees_csv.py <outfile> | |
where <outfile> is a local file path to which the csv file will be written. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Use for anonymizing strings not for cryptographic purposes | |
Makes use of the following identities:: | |
ord('1') % 48 == ord('a') % 48 == 1 | |
ord('2') % 48 == ord('b') % 48 == 2 | |
... | |
ord('6') % 48 == ord('f') % 48 == 6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
The twitter-text-python library (https://pypi.python.org/pypi/twitter-text-python) can be used | |
to urlify text containing @<username>s and #<hashtag>s. It is a bit trickier if you want to do | |
the same with HTML, but BeautifulSoup makes it straightforward. | |
""" | |
from bs4 import BeautifulSoup, NavigableString | |
from ttp import ttp | |
parse_text = ttp.Parser().parse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Resolve variable substitution in `make` include files by recursive interpolation. | |
Example: | |
$ ./info common.properties env.properties | |
or: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################################################################ | |
# Rather than run postgres in its own container, we want to run it on | |
# the (Ubuntu) host and allow: | |
# | |
# + peer connections on the host | |
# + local md5 connections from any docker container | |
# | |
# THIS IS COPY/PASTED FROM COMMAND LINE INPUT AND IS UNTESTED AS A SINGLE SCRIPT | |
################################################################################ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set-option -g status-keys vi | |
set-window-option -g mode-keys vi | |
set-window-option -g set-titles on | |
set -g set-titles-string "#T" | |
set-window-option -g mode-mouse on | |
setw -g terminal-overrides 'xterm*:smcup@:rmcup@' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Vim color file | |
" Maintainer: Juan frias <juandfrias at gmail dot com> | |
" Last Change: 2007 Feb 25 | |
" Version: 1.0.1 | |
" URL: http://www.axisym3.net/jdany/vim-the-editor/#eclipse | |
set background=dark | |
highlight clear | |
if exists("syntax_on") | |
syntax reset | |
endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
########################################################################################## | |
# | |
# create-pg-user-and-database | |
# | |
# The context here is a typical Django web app. If you have a single application instance | |
# then it is straightforward to create a database user with a randomised password, and a | |
# database which is owned by this user: | |
# |