Skip to content

Instantly share code, notes, and snippets.

View troyscott's full-sized avatar

Troy Scott troyscott

View GitHub Profile
@troyscott
troyscott / check_errorlevels.bat
Created April 10, 2013 20:32
Check error level after the SSIS package completes. If the error level does not 0 stop running the batch file.
@ECHO OFF
SET DTEXEC_PATH="C:\Program Files\Microsoft SQL Server\110\DTS\Binn\dtexec.exe"
%DTEXEC_PATH% /FILE batch_success.dtsx
IF %ERRORLEVEL% NEQ 0 GOTO STOP_JOB
%DTEXEC_PATH% /FILE batch_fail.dtsx
IF %ERRORLEVEL% NEQ 0 GOTO STOP_JOB
%DTEXEC_PATH% /FILE batch_success.dtsx
IF %ERRORLEVEL% NEQ 0 GOTO STOP_JOB
@troyscott
troyscott / process_measure_group.xmla
Created June 11, 2013 03:41
XMLA script to process a SSAS measure group.
<Process xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Object>
<DatabaseID>EDW</DatabaseID>
<CubeID>EDW Metrics</CubeID>
<MeasureGroupID>Metric Analysis</MeasureGroupID>
</Object>
<Type>ProcessFull</Type>
</Process>
create table dbo.data (
id int identity(1,1) not null,
value nvarchar(50) null );
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>JSON - Adding Objects</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="generator" content="Geany 1.23" />
<script>
// array[element][key]
@troyscott
troyscott / aws_scp.sh
Created August 8, 2013 15:53
Recursively copy a local folder to an amazon virtual server.
#!/usr/bin/env bash
scp -r -i .keys/mysshkey.pem package ubuntu@amazon_server.com:/home/ubuntu
@troyscott
troyscott / script_config.py
Created August 26, 2013 06:14
Simple python config for storing passwords and api keys. Useful when you don't want to store sensitive information in source control, Similar to the local_setttings.py for django.
MYSQL_PSWD = ''
# MASTER - [email protected]
TWILIO_ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
TWILIO_AUTH_TOKEN = "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
TWILIO_SUBACCOUNTS = {
'cust1':{'sid':'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'token':'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'},
#!/usr/bin/env sh
echo "git pull for jekyll_wp_blog"
cd /home/scottt/sync_websites/jekyll_wp_blog && git pull
jekyll build
cd .. && rsync -a -f"- .git/" -f"- README.md" -f"- js_cache/" -f"+ *" --delete jekyll_wp_blog/_site/ troyscott.github.io/
cd /home/scottt/sync_websites/troyscott.github.io && git status
echo "update troyscot.github.io website"
git add .
git commit -m 'automatic sit update'
@troyscott
troyscott / jsonp.php
Created September 8, 2013 03:32
Server side response for a jsonp request.
<?php
//header("Content-Type: application/json");
echo $_GET['callback'] . '(' . "{'name' : 'First Name'}" . ')';
?>
@troyscott
troyscott / jsonp.html
Created September 8, 2013 03:34
jsonp request to php service.
<!DOCTYPE html>
<html>
<head>
<title>JSONP Example</title>
</head>
<body>
<script src="//code.jquery.com/jquery.js"></script>
<script>
$( document ).ready(function() {
update dbo.WeeklySalesForecast
set WeekNumber = case
when CONVERT( INT,SUBSTRING(WeekNumber,5,3)) &lt; 10
then 'Week 0' + SUBSTRING(WeekNumber,6,1)
else WeekNumber end