Skip to content

Instantly share code, notes, and snippets.

deploy:
git checkout master
aws s3 sync . s3://pace.zengerink.com --cache-control "public, max-age=604800" --exclude ".git/*" --exclude "Makefile"
@tzengerink
tzengerink / OAuthConsumer.md
Last active August 29, 2015 14:01
Consume an API that uses OAuth

OAuth Consumer

Consumes an API that uses OAuth.

Copy the file example.service.cnf to service.cnf and change the configuration variables to your liking, then:

$> python2 oauth-consumer.py [http method] [uri] [data]

For example:

@tzengerink
tzengerink / application.py
Last active August 29, 2015 13:57
Python web application returning the visitors IP address
#!/usr/bin/env python
"""
IP
~~
Return visitors public IP address.
Copyright (c) 2014 Teun Zengerink
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@tzengerink
tzengerink / firewall.sh
Last active December 16, 2015 23:58
Bash script for setting up your firewall. It supports whitelisting and blacklisting.
#!/bin/bash -e
#
# IPTABLES FIREWALL
# -----------------
# Script for setting your iptables firewall. Configure the variables to your
# liking and start the firewall. Copy the file to `/usr/local/sbin` or the
# directory of your choice.
#
# Usage: `./firewall.sh [restart|start|stop|status]`
#
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
BROWSER
-------
Get internet pages, send post requests, inspect HTML using BeautifulSoup
or simply check response codes of an URL.
Example usage:
@tzengerink
tzengerink / deploy.sh
Last active December 13, 2016 15:46
Gunicorn Deploy Script
#!/bin/bash -e
#
# GUNICORN DEPLOY SCRIPT
# ----------------------
# Script to deploy your application with Gunicorn. It can be called by your
# process manager (eg. supervisor). Your application should use a virtual
# environment in a subdirectory.
#
# Copyright (c) 2013-2014, T. Zengerink
# Licensed under MIT License.
@tzengerink
tzengerink / database-modifications-table.sql
Last active October 11, 2015 08:48
Database Modifications Table
/* DATABASE MODIFICATIONS TABLE
* ----------------------------
*
* Create a database modifications table to keep track of all changes made to
* the structure of a database.
*
* At the bottom of all your scripts that modify the structure, you put a line
* like:
*
* INSERT INTO `database_modifications` (`id`, `script_name`, `comments`)
@tzengerink
tzengerink / google-search.py
Last active May 22, 2024 11:08
Google Search
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
GOOGLE SEARCH
-------------
Command line access to advanced Google searches.
To see all options use the `--help` flag.
Copyright (c) 2013, T. Zengerink
Licensed under MIT License
@tzengerink
tzengerink / desire.js
Last active March 1, 2018 15:04
Desire.js
/*!
* Desire.js
* ---------
*
* Create the namespaces you so desire.
*
* // Create a new module
* desire("APP.MyModule.MySubModule", function(){
* return {
* myProp : "Your property value",
@tzengerink
tzengerink / i18n.js
Last active October 11, 2015 03:08
I18N.js
/*!
* I18N.js
* -------
*
* Add internationalisation to your JavaScript application.
*
* // Get current language
* I18N.lang(); // en
*
* // Set current language