Skip to content

Instantly share code, notes, and snippets.

View stefanfoulis's full-sized avatar

Stefan Foulis stefanfoulis

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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:

#!/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
# -*- 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):
# -*- coding: utf-8 -*-
"""Refactor South migrations to use settings.AUTH_USER_MODEL.
Inserts a backwards-compatible code-snippet in all
your schema migration files and uses a possibly customized user
model as introduced in Django 1.5.
Please note that this has nothing to do with changing
settings.AUTH_USER_MODEL to a new model. If you do this, stuff
will very likely break in reusable apps that have their own
migration trees.
@stefanfoulis
stefanfoulis / gist:5464012
Created April 25, 2013 23:13
super simple hacky multilingual
# -*- coding: utf-8 -*-
from django.utils.translation import get_language, activate, deactivate_all, deactivate
class LanguageFieldProxy(object):
def contribute_to_class(self, cls, name):
self.name = name
setattr(cls, self.name, self)
def __get__(self, instance, instance_type=None):