Skip to content

Instantly share code, notes, and snippets.

@wsargent
wsargent / docker_cheat.md
Last active June 29, 2024 19:32
Docker cheat sheet
@rafaelcaricio
rafaelcaricio / carta_a_presidente_dilma_rousseff.mkd
Last active December 25, 2015 14:19
Translation of the letter to President Dilma Rousseff from Maddog.

Olá, presidenta Rousseff... eu lhe avisei

Carta impressa: escrita por Maddog

Jon "maddog" Hall

Querida Presidenta Rousseff,

Eu entendo que a senhora esteja irritada com meu país, os Estados Unidos da América, porque uma de

@tzermias
tzermias / pipelines.py
Last active March 14, 2024 23:35
Scrapy MySQL pipeline. Just a mirror to the asynchronous MySQL pipeline. Copy-paste it directly to pipelines.py. Database credentials are stored in settings.py. Based on http://snipplr.com/view/66986/
import MySQLdb.cursors
from twisted.enterprise import adbapi
from scrapy.xlib.pydispatch import dispatcher
from scrapy import signals
from scrapy.utils.project import get_project_settings
from scrapy import log
SETTINGS = get_project_settings()
@matheussl
matheussl / celery.config
Last active December 23, 2015 23:19
Customizando o django-fab-deploy pra funcionar com Nginx + Gunicorn + Supervisor + Celery + Redis + Rabbitmq + Mysql
[program:{{ INSTANCE_NAME }}-celery]
command={{ ENV_DIR }}/bin/python {{ PROJECT_DIR }}/manage.py celeryd worker --concurrency=5 --loglevel=info -n {{ SERVER_NAME }}
stdout_logfile={{ ENV_DIR }}/logs/celeryd.log
stderr_logfile={{ ENV_DIR }}/logs/celeryd-error.log
user=popcode
autostart=true
autorestart=true
startsecs=10
stopwaitsecs=600
@dopiaza
dopiaza / slackpost
Created September 5, 2013 12:33
Post a message to a Slack channel
#!/bin/bash
# Usage: slackpost <token> <channel> <message>
# Enter the name of your slack host here - the thing that appears in your URL:
# https://slackhost.slack.com/
slackhost=PUT_YOUR_HOST_HERE
token=$1
from fabric.api import *
from fabric.context_managers import cd
from fabric.operations import local as lrun, sudo
from fabric.contrib.files import sed
from fabric.utils import warn
from local_fabfile import root, prod, lh, SERVER_IP
def virtualenv(command, run_directory=''):
if run_directory == '':
@abhinavsingh
abhinavsingh / forwarder.py
Created August 29, 2013 13:29
Tornado websockets and ZMQ pubsub
import zmq
def main():
try:
context = zmq.Context(1)
frontend = context.socket(zmq.SUB)
frontend.bind('tcp://*:5559')
frontend.setsockopt(zmq.SUBSCRIBE, '')
@dsuch
dsuch / sqlalchemy_json.py
Last active December 9, 2016 19:57
Converting SQLAlchemy objects to JSON
# stdlib
from json import dumps
def to_json(model):
""" Returns a JSON representation of an SQLAlchemy-backed object.
"""
json = {}
json['fields'] = {}
json['pk'] = getattr(model, 'id')
@jbgo
jbgo / Vagrantfile
Created August 18, 2013 20:51
Getting started with ansible on OS X
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.33.10"
config.ssh.forward_agent = true
@matthiasg
matthiasg / docs style (bootstrap)
Created August 5, 2013 06:26
the callouts from the bootstrap documentation
/* Side notes for calling out things
-------------------------------------------------- */
/* Base styles (regardless of theme) */
.bs-callout {
margin: 20px 0;
padding: 15px 30px 15px 15px;
border-left: 5px solid #eee;