This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
from pybars import Compiler | |
from closeio_api_client.api import CloseIO_API as CloseIO | |
# We ensure the same templateid doesn't get sent again (see the search query construction) | |
emails = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def stripe_invoice_created_webhook(stripe_event): | |
"""Called by Stripe when an invoice is created so we can log it and tell Stripe about any charges to add.""" | |
stripe_event_invoice = stripe_event['data']['object'] | |
stripe_invoice = stripe.Invoice.retrieve(stripe_event_invoice['id']) | |
orgs = Organization.objects.filter(status=OrganizationStatus.Paying, stripe_customer_id=stripe_invoice.customer) | |
for org in orgs: | |
if org.manual_billing: | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Manages swapspace on a node. | |
# | |
# Based on https://gist.github.com/Yggdrasil/3918632 | |
# | |
# Parameters: | |
# - $ensure Allows creation or removal of swapspace and the corresponding file. | |
# - $swapfile Defaults to /mnt which is a fast ephemeral filesystem on EC2 instances. | |
# This keeps performance reasonable while avoiding I/O charges on EBS. | |
# - $swapsize Size of the swapfile in MB. Defaults to memory size. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Defaults for supervisor initscript | |
# sourced by /etc/init.d/supervisor | |
# installed at /etc/default/supervisor by the maintainer scripts | |
# | |
# This is a POSIX shell fragment | |
# | |
# Additional options that are passed to the Daemon. | |
DAEMON_OPTS="-c /etc/supervisor/supervisord.conf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from fabric.api import * | |
PUPPETMASTER_HOST = 'ecxxxxxxxxxxxx.us-west-2.compute.amazonaws.com' | |
DOMAIN = 'example.com' | |
def set_hostname(hostname, domain): | |
"""Sets the hostname and FQDN for an instance. Should persist after reboot. | |
We want to get 'hostname' to return our hostname (e.g. "foo"). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import time | |
import boto | |
import boto.ec2.elb | |
import boto.utils | |
from flask.ext.script import Manager | |
from closeio.main import setup_app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use Mysql; | |
use strict; | |
use vars qw($school_name); | |
use vars qw($pass); | |
require "./cgi-lib.pl"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use the router(s) for any internal (relative) links, unless it has a | |
// `data-bypass` attribute or is `target=_blank` | |
$(document).on('click', 'a:not([data-bypass],[target])', function(evt) { | |
var href = $(this).attr('href'), | |
protocol = this.protocol + '//'; | |
// For <a href="#"> links, we always want to preventDefault to avoid having to do | |
// this within each individual Backbone View event function. | |
// (However don't preventDefault on #something URLs in case we need to jump down a page.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There was an old lady called Wright | |
who could travel much faster than light. | |
She departed one day | |
in a relative way | |
and returned on the previous night. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rest_client' | |
require 'json' | |
API_KEY = 'your api key here' | |
api_base = 'https://' + API_KEY + ':@api.close.com/api/v1/' | |
# get info about yourself | |
RestClient.get api_base+'me/' | |
# post a lead |