Skip to content

Instantly share code, notes, and snippets.

Avatar

Timothée Peignier cyberdelia

  • Vancouver, BC
View GitHub Profile
View secure-agent.fish
function __agent_is_started -d "check if ssh agent is already started"
if begin; test -f $SSH_ENV; and test -z "$SSH_AGENT_PID"; end
source $SSH_ENV > /dev/null
end
if test -z "$SSH_AGENT_PID"
return 1
end
ps -p $SSH_AGENT_PID > /dev/null
@cyberdelia
cyberdelia / mixin.py
Created Sep 21, 2011
Django class based view mixins
View mixin.py
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.utils.cache import patch_response_headers
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page, never_cache
from django.views.decorators.csrf import csrf_exempt
class NeverCacheMixin(object):
@method_decorator(never_cache)
@cyberdelia
cyberdelia / fabfile.py
Created Apr 3, 2010
Fabric deploy script with : south migrations, rollback and maintenance page.
View fabfile.py
from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['example.com',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = "app.example.com"
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }
@cyberdelia
cyberdelia / cache_control.py
Created Apr 2, 2010
Set cache-control headers for a s3 public bucket
View cache_control.py
#!/usr/bin/env python
# encoding: utf-8
from boto.s3.connection import S3Connection
AWS_ACCESS_KEY = '<aws access key>'
AWS_SECRET_KEY = '<aws secret key>'
AWS_BUCKET_NAME = '<aws bucket name>'
AWS_HEADERS = {
'Cache-Control':'max-age=31556926,public'
}
@cyberdelia
cyberdelia / domainr.py
Created Nov 1, 2009
Find every available domain from a dictionary
View domainr.py
#!/usr/bin/env python
# encoding: utf-8
import sys, json, urllib
from optparse import OptionParser
def main():
parser = OptionParser()
parser.add_option("-e", "--extension", action="append", type="string", dest="extensions", help="specify domain extension", default=[])
parser.add_option("-a", "--availability", action="store", type="choice", choices=["taken", "maybe", "available", "unavailable", "tld"], dest="availability", help="specifiy level of availability", default="available")
parser.set_defaults(verbose=True)
You can’t perform that action at this time.