Skip to content

Instantly share code, notes, and snippets.

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

#!/bin/sh
#
# This script will hold your hand during the process of converting an existing Drupal 7 file field from public to private.
#
# http://twitter.com/thsutton
# http://www.linkedin.com/pub/thomas-sutton/55/391/350
# http://thomas-sutton.id.au/
set -eu
@tobiase
tobiase / .bashrc
Last active August 29, 2015 14:25 — forked from clneagu/.bashrc
# Call virtualenvwrapper's "workon" if .venv exists. This is modified from--
# http://justinlilly.com/python/virtualenv_wrapper_helper.html
# which is linked from--
# http://virtualenvwrapper.readthedocs.org/en/latest/tips.html#automatically-run-workon-when-entering-a-directory
check_virtualenv() {
if [ -e .venv ]; then
env=`cat .venv`
if [ "$env" != "${VIRTUAL_ENV##*/}" ]; then
echo "Found .venv in directory. Calling: workon ${env}"
workon $env
@tobiase
tobiase / gist:8b65269ce6a601e29c03
Last active August 29, 2015 14:27 — forked from ebuildy/gist:5d4ad0998848eaefdad8
Setup sentry logger on a fresh Ubuntu server
sudo apt-get update
sudo apt-get install python-virtualenv
sudo apt-get install python-dev
sudo apt-get install postgresql
sudo apt-get install postgresql-server-dev-9.3
sudo apt-get install redis-server
sudo -u postgres createuser -s sentry
sudo -u postgres psql -c "alter user sentry with password 'sentry';"
@tobiase
tobiase / German-Zip-Codes.csv
Created October 8, 2015 17:07 — forked from jbspeakr/German-Zip-Codes.csv
list of German zip codes (Postleitzahl), including dialing code, name of the city and federal state.
We can't make this file beautiful and searchable because it's too large.
Ort;Zusatz;Plz;Vorwahl;Bundesland
Aach;b Trier;54298;0651;Rheinland-Pfalz
Aach;, Hegau;78267;07774;Baden-Württemberg
Aachen;;52062;0241;Nordrhein-Westfalen
Aachen;;52064;0241;Nordrhein-Westfalen
Aachen;;52066;0241;Nordrhein-Westfalen
Aachen;;52068;0241;Nordrhein-Westfalen
Aachen;;52070;0241;Nordrhein-Westfalen
Aachen;;52072;0241;Nordrhein-Westfalen
Aachen;;52074;0241;Nordrhein-Westfalen
@tobiase
tobiase / drop_tables.sh
Created October 21, 2015 22:08 — forked from vijinho/drop_tables.sh
drop empty tables
#!/bin/sh
# path settings
MYSQL=`which mysql`
# mysql settings
DB="MYDB"
HOST="127.0.0.1"
USER="root"
PASS="root"
@tobiase
tobiase / README.md
Created November 3, 2015 01:10 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
@tobiase
tobiase / models.py
Last active October 4, 2021 11:08
Prefill wagtailforms with URL parameters
from __future__ import absolute_import, unicode_literals
import django
import django.forms
import wagtail.wagtailforms.models as form_models
from django.db import models
from django.shortcuts import render
from django.utils.translation import ugettext_lazy as _
from modelcluster.fields import ParentalKey
from wagtail.wagtailadmin.edit_handlers import (
@tobiase
tobiase / fabfile.py
Created January 23, 2018 18:37 — forked from saevarom/fabfile.py
Fabfile template for Overcast Software
from __future__ import with_statement
from fabric.api import *
from fabric.operations import get
from fabric.contrib.files import exists
from contextlib import contextmanager
import os
env.roledefs = {
'web': ['server1.example.com', 'server2.example.com'],
@tobiase
tobiase / pyenv_ssl_archlinux.sh
Created March 1, 2018 10:47 — forked from tianchaijz/pyenv_ssl_archlinux.sh
Script to solve python compilation with ssl on Arch Linux
#!/bin/bash
# http://stackoverflow.com/questions/23548188/how-do-i-compile-python-3-4-with-custom-openssl
openssl_version="openssl-1.0.2g"
openssl_package="${openssl_version}.tar.gz"
openssl_home="/opt/$openssl_version"
curl https://www.openssl.org/source/$openssl_package | tar xz && cd $openssl_version && ./config shared --prefix=$openssl_home && make -j8 && sudo make install
export CFLAGS="-I$openssl_home/include"