Skip to content

Instantly share code, notes, and snippets.

View troyscott's full-sized avatar

Troy Scott troyscott

View GitHub Profile
# fabric extension to enable handling expected prompts
#
# Read more at http://ilogue.com/jasper/blog/fexpect--dealing-with-prompts-in-fabric-with-pexpect/
#
# This file Copyright (c) Jasper van den Bosch, ilogue, [email protected]
# Pexpect Copyright (c) 2012 Noah Spurrier ,see: http://www.noah.org/wiki/pexpect#License
from fabric.state import env
import fabric.api
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
// this identifies your website in the createToken call below
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Sample Form</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript">
@troyscott
troyscott / twilio_pycurl.py
Created January 27, 2013 08:37
Example of using pycurl to transfer a phone number from a Twilio SubAccount to the Master Account. Couldn't get this to work with the python twilio client.
import pycurl
# http://www.twilio.com/docs/api/rest/subaccounts#exchanging-numbers
def reset_demo(phone_sid):
base = "https://api.twilio.com/2010-04-01/Accounts/"
master_sid = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
master_token = "auth token"
subaccount = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
@troyscott
troyscott / dtexec_batch_load.bat
Created January 30, 2013 03:53
Windows batch file for running one or more SSIS packages from the command line. The script loops though a set of packages (delimited by spaces) that share the same config file and logging.
@ECHO OFF
SET DTEXEC_PATH="C:\Program Files\Microsoft SQL Server\100\DTS\Binn\dtexec.exe"
SET PACKAGE_PATH=C:\path\to\packages\
REM LogFileConnection name should be setup in the dtsConfig file
SET PACKAGE_LOG="DTS.LogProviderTextFile;[LogFileConnection]"
REM Path to dtsConfig File (filename.dtsConfig)
SET PACKAGE_CONFIG="C:\path\to\dtsConfig"
SET PACKAGES=Package1.dtsx Package2.dtsx
@ECHO OFF
SET DTEXEC_PATH="C:\Program Files\Microsoft SQL Server\100\DTS\Binn\dtexec.exe"
SET PACKAGE_PATH=C:\project\ssis\
SET PACKAGE_LOG="DTS.LogProviderTextFile;MyLogConnection.txt"
SET PACKAGE_CONFIG=C:\project\config\
%DTEXEC_PATH% /FILE %PACKAGE_PATH%MyPackage.dtsx /LOGGER %PACKAGE_LOG% /CONFIG %PACKAGE_CONFIG%MyFirstConfig.dtsConfig /CONFIG %PACKAGE_CONFIG%MySecondConfig.dtsConfig
@troyscott
troyscott / ga_etl.bat
Created March 7, 2013 22:12
Batch file which calls a Python script.
@ECHO OFF
:: Extract Google Analytics Data
:: Developed by: Troy Scott
:: Created: March 5, 2013
:: Modified: March 7,2013
SET PROJECT_PATH=%CD%
SET GOALS_FILE=ga_goals.dat
SET GEO_MED_FILE=ga_geo_med.dat
SET EVENTS_FILE=ga_events.dat
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
namespace UrlParser
{
@troyscott
troyscott / mailgun_import_data.py
Last active December 15, 2015 13:39
Bottle server that allows you to test files (e.g. csv files) forwarded by Mail Gun. Setup mailgun account on Mail Client or Tablet/Smartphone or for larger deployment setup SMTP Relay: http://documentation.mailgun.net/user_manual.html#smtp-relay Run this server on a desktop or laptop using a service like pagekite: http://pagekite.net Make the pa…
from bottle import route, run, post, get, request
import bottle
"""
Setup mailgun account on Mail Client or Tablet/Smartphone or
for larger deployment setup SMTP Relay:
http://documentation.mailgun.net/user_manual.html#smtp-relay
@troyscott
troyscott / computed_fields.sql
Created April 4, 2013 18:00
List of computed columns by table for a database.
select
s.name SchemaName
,object_name(cc.object_id) as TableName
,c.is_computed
,cc.name
,cc.column_id
,cc.definition
from sys.computed_columns cc inner join sys.columns c
on cc.object_id = c.object_id and cc.column_id = c.column_id