Skip to content

Instantly share code, notes, and snippets.

View frankV's full-sized avatar
🦑
Work Hard. Cuttlesoft.

Frank Valcarcel frankV

🦑
Work Hard. Cuttlesoft.
View GitHub Profile
@richleland
richleland / settings.py
Created October 29, 2011 11:00
S3BotoStorage subclass for media and static buckets
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
STATICFILES_STORAGE = 'path.to.storage.S3StaticStorage'
THUMBNAIL_DEFAULT_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_ACCESS_KEY_ID = 'YOUR KEY'
AWS_SECRET_ACCESS_KEY = 'YOUR KEY'
AWS_STORAGE_BUCKET_NAME = 'media.YOURSITE.com'
AWS_STATIC_BUCKET_NAME = 'static.YOURSITE.com'
AWS_S3_CUSTOM_DOMAIN = AWS_STORAGE_BUCKET_NAME
AWS_STATIC_CUSTOM_DOMAIN = AWS_STATIC_BUCKET_NAME
STATIC_URL = 'http://%s/' % AWS_STATIC_BUCKET_NAME
@jobliz
jobliz / RedisPythonPubSub1.py
Created May 4, 2012 17:58
A short script exploring Redis pubsub functions in Python
import redis
import threading
class Listener(threading.Thread):
def __init__(self, r, channels):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
self.pubsub.subscribe(channels)
@ibeex
ibeex / foo.log
Created August 4, 2012 13:46
Flask logging example
A warning occurred (42 apples)
An error occurred
@jpennell
jpennell / fabfile.py
Created September 18, 2012 01:15
Fabric fabfile for Django/Heroku App
from fabric.api import env, local, require
def deploy():
"""fab [environment] deploy"""
require('environment')
maintenance_on()
push()
syncdb()
migrate()
@Tukki
Tukki / gist:3953990
Created October 25, 2012 16:52
filter by time in sqlalchemy
#http://stackoverflow.com/questions/7075828/make-sqlalchemy-use-date-in-filter-using-postgresql
from sqlalchemy import Date, cast
from datetime import date
my_date = (session.query(MyObject)
.filter(cast(MyObject.date_time, Date) == date.today())
.all())
@elvisimprsntr
elvisimprsntr / siriproxy-raspberrypi.txt
Last active January 4, 2019 00:45
SiriProxy running on a Raspberry Pi computer.
# $Header: /root/RCS/siriproxy-raspberrypi.txt,v 1.9 2013/11/09 08:11:00 root Exp $
# $Log: siriproxy-raspberrypi.txt,v $
# Revision 1.9 2013/11/09 08:11:00 root
# updated for latest RVM which installs dependencies and Ruby by default
#
# Revision 1.8 2013/03/22 20:41:20 root
# updated for Ruby 2.0.0 and SiriProxy 0.5.2
#
# Revision 1.7 2012/12/31 04:42:57 root
# shorter URL for newark and typos
@legege
legege / mjpeg-directives.html
Created April 3, 2013 14:02
This is an AngularJS directive for MJPEG streams. This directive uses an iframe to stop the browser from loading the MJPEG stream. This is useful for Chrome: https://code.google.com/p/chromium/issues/detail?id=73395
<mjpeg url="videoUrl"></mjpeg>
@mattupstate
mattupstate / module.sublime-snippet
Created July 19, 2013 13:55
A simple Python module header snippet for Sublime Text
<snippet>
<tabTrigger>module</tabTrigger>
<scope>source.python</scope>
<description>Module</description>
<content><![CDATA[# -*- coding: utf-8 -*-
"""
${1:name}
${1/./~/g}
@my-slab
my-slab / get_posts.py
Last active May 10, 2018 17:32
Basic example of using the Python for Facebook SDK to get all the posts on a user's timeline.
import facebook
import requests
def some_action(post):
""" Here you might want to do something with each post. E.g. grab the
post's message (post['message']) or the post's picture (post['picture']).
In this implementation we just print the post's created time.
"""
print post['created_time']
@mmautner
mmautner / app.py
Last active October 22, 2019 18:09
Example of caching API results w/ Flask-Restless
import json
import hashlib
import flask
import flask.ext.sqlalchemy
import flask.ext.restless
from flask.ext.restless import ProcessingException
app = flask.Flask(__name__)
app.config['DEBUG'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'