Skip to content

Instantly share code, notes, and snippets.

View stefanfoulis's full-sized avatar

Stefan Foulis stefanfoulis

View GitHub Profile
# -*- coding: utf-8 -*-
from waffle import TEST_COOKIE_NAME, flag_is_active
from waffle.middleware import WaffleMiddleware
# FIXME: only works if TEST_COOKIE_NAME ends with the flag name
TEST_COOKIE_PREFIX = TEST_COOKIE_NAME.split('%s')[0]
class AlwaysWaffleMiddleware(WaffleMiddleware):
#!/bin/bash
# devpi install for a dedicated ubuntu server with upstart
# based on http://tim.freunds.net/blog/devpi.html
# execute as root (sudo)
set -ex # exit on error, print executed commands
DEVPI_VENV=/opt/devpi
DEVPI_USER=devpi
@stefanfoulis
stefanfoulis / keybase.md
Created March 10, 2014 19:35
keybase.md

Keybase proof

I hereby claim:

  • I am stefanfoulis on github.
  • I am stefanfoulis (https://keybase.io/stefanfoulis) on keybase.
  • I have a public key whose fingerprint is A1DC 0DA1 3DD4 3B95 6606 971C 4DA2 0ED6 A49D EE57

To claim this, I am signing this object:

@stefanfoulis
stefanfoulis / admin.py
Created April 17, 2014 08:14
no-bulk-delete django admin action
class NoBulkDeleteAdmin(admin.ModelAdmin):
def get_actions(self, request):
actions = super(NoBulkDeleteAdmin, self).get_actions(request)
del actions['delete_selected']
actions['delete_selected'] = (
NoBulkDeleteAdmin.no_bulk_delete,
'delete_selected',
'Delete Selected instances and delete docker instances.'
)
return actions
@stefanfoulis
stefanfoulis / gist:f381338b1cd16c6cbf8d
Created June 1, 2014 19:10
deis/example-python-django fails to build
# git push deis master
Counting objects: 1, done.
Writing objects: 100% (1/1), 186 bytes | 0 bytes/s, done.
Total 1 (delta 0), reused 0 (delta 0)
-----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.6.
-----> Preparing Python runtime (python-2.7.6)
remote: /tmp/buildpacks/heroku-buildpack-python/bin/compile: line 186: cd: /tmp/buildpacks/heroku-buildpack-python/vendor/setuptools-3.6/: No such file or directory
-----> Installing Setuptools (3.6)
remote: /tmp/buildpacks/heroku-buildpack-python/bin/compile: line 193: cd: /tmp/buildpacks/heroku-buildpack-python/vendor/pip-1.5.5/: No such file or directory
@stefanfoulis
stefanfoulis / 0001_old_migration.py
Last active June 13, 2016 08:38
reliably upgrading my plugins to the new django-cms 3.0 table names
"""
Do not rename the table for plugins in the first "create" migration.
OR: if you do... make the create table statement only run if the table does not already exist.
"""
class Migration():
def forwards(self, orm):
# ...
@stefanfoulis
stefanfoulis / README.md
Last active June 10, 2021 03:18
raspberry pi setup

my raspberry pi setup

  • basic setup
  • auto-login on startup
  • chromium
  • shared user with google sync for bookmarks in chromium
  • auto-start chromium with shared bookmark in fullscreen mode (
  • setup synergy
  • setup ssh tunnel for synergy (with restricted rights) (client: ssh -f -N -L 24800:server-hostname:24800 server-hostname)
  • share ssh with zeroconf
@stefanfoulis
stefanfoulis / adjectives.txt
Last active August 29, 2015 14:05
Aldryn Server Names
eloquent
saggy
shabby
lonely
sexist
obnoxious
pleasant
wonderous
sleek
slimy
@stefanfoulis
stefanfoulis / delete_docker_logs.sh
Created September 16, 2014 09:05
delete docker logs
find /var/lib/docker/containers/ -type f -name "*.log" -delete
@stefanfoulis
stefanfoulis / gist:dda6b4a2ba91a615b9bb
Created May 24, 2015 20:30
accessing the django file object
# f is the File model
f = filer.models.File.objects.get(...)
# f.file is a django file field (for images it's an easy-thumbnails image field)
f.file