Skip to content

Instantly share code, notes, and snippets.

import environ
from .local import LOGGING
ROOT_DIR = environ.Path(__file__) - 3 # (/a/b/myfile.py - 3 = /)
# speed up tests
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
MEDIA_ROOT = str(ROOT_DIR.path('media_files'))
#!/bin/bash
VERSION="v5.7.1"
ARCH="linux-x64"
ARCHIVE="node-${VERSION}-${ARCH}.tar.gz"
URL="https://nodejs.org/dist/${VERSION}/${ARCHIVE}"
if [ -z "${VIRTUAL_ENV}" ]; then
echo "Please activate a virtualenv first";
exit
@pterk
pterk / node-ve.sh
Created February 1, 2014 22:24
Install node in a (python) virtual environment
#!/bin/bash
VERSION="v0.10.25"
ARCHIVE=node-${VERSION}.tar.gz
if [ -z "${VIRTUAL_ENV}" ]; then
echo "Please activate a virtualenv first";
exit
fi
class A(object):
def __init__(self):
print self
def throw_bananas(self):
#super(A, self).throw_bananas()
print 'class A'
class B(object):
def __init__(self):
print self
@pterk
pterk / fabfile.py
Last active December 14, 2015 20:08
fabfile to be used in conjunction with beeswithmachineguns
""" fabfile to be used in conjunction with beeswithmachineguns
(Note, at time of wrinting (2013-03-12): use the version from
github. pip install beeswithmachineguns will install an old version
that does not support setting the zone)
Once bees is installed you can use the fabfile to execute fab commands
on the unleashed bees. The gist shows how to use ab as an example
which is probably better done with 'BWM' but you can see where to take
if from here (also note this example doesn't divide the work among the
diff --git a/feedly/connection.py b/feedly/connection.py
index c6ba0d1..a41fa5c 100644
--- a/feedly/connection.py
+++ b/feedly/connection.py
@@ -1,10 +1,9 @@
-from nydus.db import create_cluster
-
#cache this at the process module level
connection_cache = {}
@pterk
pterk / redis-ve
Last active September 26, 2018 15:42
install redis in a virtualenv
#!/bin/bash
VERSION="2.8.5"
ARCHIVE=redis-${VERSION}.tar.gz
if [ -z "${VIRTUAL_ENV}" ]; then
echo "Please activate a virtualenv first";
exit
fi
pushd /tmp/
@pterk
pterk / rrr.py
Created July 10, 2012 19:21
Small incremental size and bandwidth effective backup solution using rsync and hardlinks
#!/usr/bin/env python
"""Rotating Remote Rsync backup script in python
This code is a reworked python version of a script by Grenville
Armitage from the Centre for Advanced Internet Architectures,
Swinburne University of Technology I found online that is ultamately
derived from
http://www.mikerubel.org/computers/rsync_snapshots/#Incremental
"""