Skip to content

Instantly share code, notes, and snippets.

View Miserlou's full-sized avatar

Rich Jones Miserlou

View GitHub Profile
@Miserlou
Miserlou / tor_guide.txt
Created June 11, 2012 09:35
Tor Guide/FAQ Draft
This thread can house answer to common questions - installing Tor, how safe is Tor, etc. Hopefully that will de-clutter the front page a bit. Contribute to this guide here: https://gist.github.com/2909317
**FAQ**
*How do I install Tor?*
Go here: https://www.torproject.org/download/download-easy.html.en
*How safe is Tor?*
@Miserlou
Miserlou / multiline.js
Created June 24, 2012 00:54
Multiline Javascript
var publicKey = our_data.servers['servername.com'].publicKey.join('\n');
# Start with our base settings
from .settings import *
# Copy our working DB to /tmp..
from shutil import copyfile
src = os.path.join(BASE_DIR, 'db.sqlite3')
dst = "/tmp/db.sqlite3"
copyfile(src, dst)
# ..and use it!
@Miserlou
Miserlou / drift.js
Created March 27, 2017 19:28
Drift JS
<!-- Start of Async Drift Code -->
<script>
var YOUR_CODE = 'BLAH_BLAH_BLAH';
!function() {
var t;
if (t = window.driftt = window.drift = window.driftt || [], !t.init) return t.invoked ? void (window.console && console.error && console.error("Drift snippet included twice.")) : (t.invoked = !0,
t.methods = [ "identify", "config", "track", "reset", "debug", "show", "ping", "page", "hide", "off", "on" ],
t.factory = function(e) {
return function() {
var n;
@Miserlou
Miserlou / zappa_task_example.py
Created March 29, 2017 17:09
zappa_task_example.py
import flask
from zappa.async import task
@task
def make_pie():
""" This takes a long time! """
ingredients = get_ingredients()
pie = bake(ingredients)
deliver(pie)
@Miserlou
Miserlou / task_sns.py
Created March 29, 2017 17:33
task_sns.py
from zappa.async import task_sns
@task_sns
@Miserlou
Miserlou / async_zappa_settings.js
Last active March 29, 2017 17:34
async_zappa_settings.js
{
"dev": {
..
"async_source": "sns", // Source of async tasks. Defaults to "lambda"
"async_resources": true, // Create the SNS topic to use. Defaults to true.
..
}
}
@Miserlou
Miserlou / run.py
Created March 29, 2017 17:35
run.py
from zappa.async import run
run(your_function, args, kwargs) # Using Lambda
run(your_function, args, kwargs, service='sns') # Using SNS
@Miserlou
Miserlou / nodb_example.py
Created April 10, 2017 14:05
nodb_example.py
from nodb import NoDB
nodb = NoDB()
nodb.bucket = "my-s3-bucket"
nodb.index = "name"
# Save an object!
user = {"name": "Jeff", "age": 19}
nodb.save(user) # True
class User(object):
name = None
age = None
def print_name(self):
print "Hi, I'm " + self.name + "!"
new_user = User()
new_user.name = "Jeff"
new_user.age = 19