Skip to content

Instantly share code, notes, and snippets.

View NickWoodhams's full-sized avatar

Nick Woodhams NickWoodhams

View GitHub Profile
@NickWoodhams
NickWoodhams / indico_text_tags.txt
Created June 2, 2015 03:40
indico text tags (API v2)
Dieting
Golf
Fishing
Islam
Relationships
Atheism
Hunting
Personal
Nostalgia
Writing
@NickWoodhams
NickWoodhams / google_website_categories.txt
Created June 2, 2015 03:42
Website Categories - Google
Arts & Entertainment
Beauty & Personal Care
Business & Industrial
Computers & Consumer Electronics
Dining & Nightlife
Family & Community
Finance
Food & Groceries
Health
Hobbies & Leisure
@NickWoodhams
NickWoodhams / mount.sh
Created June 2, 2015 20:58
Mount NFS Volume on Mac
#!/bin/bash
mkdir /Volumes/disk2
mount -t nfs m3dia.us:/export/disk2 /Volumes/disk2
@NickWoodhams
NickWoodhams / select2ify.js
Created December 13, 2012 20:35
Activate the Select2 Library on any webpage with this Javascript Bookmarklet
function loadJSInclude(scriptPath, callback)
{
var scriptNode = document.createElement('SCRIPT');
scriptNode.type = 'text/javascript';
scriptNode.src = scriptPath;
var headNode = document.getElementsByTagName('HEAD');
if (headNode[0] !== null)
headNode[0].appendChild(scriptNode);
@NickWoodhams
NickWoodhams / uwsgi.conf
Created January 17, 2013 00:14
my uWSGI Emperor Init (Upstart script)
# Emperor uWSGI script
description "uWSGI Emperor"
start on runlevel [2345]
stop on runlevel [06]
respawn
exec /usr/bin/uwsgi --master --enable-threads --emperor /etc/uwsgi/apps-enabled --die-on-term --uid www-data --gid www-data --logto /var/log/uwsgi/emperor.log
@NickWoodhams
NickWoodhams / app.py
Created June 3, 2013 08:26
Flask Github post-receive hook
@app.route('/post-receive-hook', methods=['GET', 'POST'])
def post_receive_hook():
if request.method == "POST" and request.form['payload']:
payload = json.loads(request.form['payload'])
pprint(payload)
output = subprocess.Popen('sh /home/user/post-receive-script.sh'.split(), stdout=subprocess.PIPE).communicate()[0]
print output # for debugging
return "Hi!"
else:
abort(404)
@NickWoodhams
NickWoodhams / ndissite
Created June 10, 2013 15:14
Nginx and Uwsgi helpers for enabling sites/apps by automatically creating symlinks
#!/bin/bash
if [ "$1" ]; then
#site argument is set
if [ -L /etc/nginx/sites-enabled/$1 ]; then
#symbolic link does not exist, enable the site
echo "Disabling nginx site $1!"
sudo rm /etc/nginx/sites-enabled/$1
sudo service nginx restart
else
#symbolic link exists, give the user a message
@NickWoodhams
NickWoodhams / embed-button.js
Last active December 18, 2015 16:29
API Xchange Embed Button
<script id="apixchange-embed-script" src="//apixchange.com/static/js/embed-button.js"></script>
@NickWoodhams
NickWoodhams / embed-button.html
Created June 19, 2013 03:17
API Xchange HTML Button Embed
<a href="https://apixchange.com"><img alt="API Xchange" src="https://apixchange.com/static/img/embed-button.png"></a>
@NickWoodhams
NickWoodhams / gist:5811459
Created June 19, 2013 03:20
HTML + CSS API Xchange Button Embed
<style>
.apixchange-embed-button {
font-family: "Lato", sans-serif;
display: inline-block;
border: 2px solid #eee;
border-radius: 5px;
background: #FFF;
width: 227px;
white-space: nowrap;
}