Skip to content

Instantly share code, notes, and snippets.

View stefanfoulis's full-sized avatar

Stefan Foulis stefanfoulis

View GitHub Profile
#!/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 / adjectives.txt
Last active August 29, 2015 14:05
Aldryn Server Names
eloquent
saggy
shabby
lonely
sexist
obnoxious
pleasant
wonderous
sleek
slimy
@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
@stefanfoulis
stefanfoulis / search_indexes.py
Created May 4, 2010 08:08 — forked from beniwohli/search_indexes.py
fork with support for cms placeholders (upcoming cms 2.1 release)
from django.conf import settings
from django.utils.translation import string_concat, ugettext_lazy
from django.utils.html import strip_tags
from haystack import indexes, site
from cms.models.managers import PageManager
from cms.models.pagemodel import Page
from cms.models.pluginmodel import CMSPlugin
@stefanfoulis
stefanfoulis / fd.py
Last active September 15, 2015 15:54
super naive open files check for datadog
from checks import AgentCheck
class FileDescriptorCheck(AgentCheck):
def check(self, instance):
with open('/proc/sys/fs/file-nr', 'r') as fobj:
fd_open, unknown, fd_max = fobj.read().split('\t')
self.gauge('system.fd_open', int(fd_open))
self.gauge('system.fd_max', int(fd_max))
self.gauge('system.fd_open_pct', float(fd_open)/float(fd_max))
@stefanfoulis
stefanfoulis / gist:1011159
Created June 6, 2011 21:30
copy command that copies HFS-Resource forks and metadata
sudo ditto -rsrc /Users/username /Volumes/OtherDisk/Users/
@stefanfoulis
stefanfoulis / at_commit.cfg
Created June 10, 2011 15:37
using external git sources in buildout
[buildout]
...
parts =
...
django-filer-git
[django-filer-git]
recipe=zerokspot.recipe.git
repository=git://github.com/stefanfoulis/django-filer.git
rev=c10e7e0b618b7718ae518ec33ecc8d5de6b62eaa