Skip to content

Instantly share code, notes, and snippets.

View snowch's full-sized avatar

Chris Snow snowch

View GitHub Profile
@snowch
snowch / load_cloudant.py
Created May 12, 2015 21:48
Baltimore City Employee Salaries FY2014
#!/usr/bin/env python
import requests, json
CL_USERNAME = CHANGE_ME
CL_PASSWORD = CHANGE_ME
AUTH=(CL_USERNAME, CL_PASSWORD)
jsondata = requests.get('https://data.baltimorecity.gov/api/views/2j28-xzd7/rows.json?accessType=DOWNLOAD')

Objective

Test that changing the database linked to the account is thread safe.

How to test by making parallel invocations of?

  • /vechicles
  • /customers

How can you be sure that a parallel invocation of /vehicles and /customers will actually run parallel? E.g. on different cores at exactly the same time?

@snowch
snowch / dixondates.R
Last active August 29, 2015 14:11 — forked from noamross/dixondates.R
#'% Using Dates and Times in R
#'% Bonnie Dixon
#'% 14-02-10 15:09:57
#'
#' *Today at the [Davis R Users'
#' Group](http://www.noamross.net/davis-r-users-group.html), [Bonnie
#' Dixon](http://ffhi.ucdavis.edu/people/directory/bmdixon) gave a tutorial on the
#' various ways to handle dates and times in R. Bonnie provided this great script
#' which walks through essential classes, functions, and packages. Here it is piped through
#' `knitr::spin`. The original R script can be found as a gist
@snowch
snowch / index.sh
Last active August 29, 2015 14:08
cloudant query utility script
#!/bin/bash
set -e
USERNAME=snowch
DBNAME=stackoverflow
SCRIPT=$(basename $0)
if [[ ! $1 =~ (create)|(list)|(delete)|(find) ]]; then
@snowch
snowch / buildsource.pp
Created October 5, 2014 15:42
puppet build from source
#
# Depends on: puppetlabs/stdlib
#
define buildsource(
$dir = $title,
$user = 'root',
$path = '/usr/bin:/bin',
$timeout = '0',
$options = ''
) {
@snowch
snowch / init.pp
Created October 5, 2014 15:27
puppet erlang package install
class erlang($version = '1:17.3') {
Apt::Pin <| |> -> Package <| |>
Apt::Source <| |> -> Package <| |>
apt::source { 'erlang_repo':
location => 'http://packages.erlang-solutions.com/ubuntu',
repos => 'contrib',
key => 'A14F4FCA'
}
INFO global: Vagrant version: 1.6.2
INFO global: Ruby version: 2.0.0
INFO global: RubyGems version: 2.0.14
INFO global: VAGRANT_EXECUTABLE="C:\\HashiCorp\\Vagrant\\embedded\\gems\\gems\\vagrant-1.6.2\\bin\\vagrant"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="C:\\HashiCorp\\Vagrant\\embedded"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_INTERNAL_BUNDLERIZED="1"
INFO global: VAGRANT_LOG="debug"
INFO global: Plugins:
@snowch
snowch / maven debug output
Last active August 29, 2015 14:01
Stratos mvn build issue
Listening for transport dt_socket at address: 8888
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.8.0-19-generic", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /home/vagrant/.m2/settings.xml
@snowch
snowch / config_sh_output_log
Created April 27, 2014 06:41
Config.sh output log
This script will install and configure puppet agent, do you want to continue [y/n]y
--2014-04-27 05:44:36-- http://169.254.169.254/latest/user-data
Connecting to 169.254.169.254:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2014-04-27 05:44:37 ERROR 404: Not Found.
Please provide stratos service-name:php
Please provide puppet master IP:192.168.56.5
Please provide puppet master hostname [puppet.stratos.org]:puppet.stratos.com
[ERROR] Failed to execute goal on project apache-stratos-load-balancer: Could not resolve dependencies for project org.apache.stratos.load.balancer:apache-stratos-load-balancer:pom:4.0.0-incubating: Failed to collect dependencies for [org.wso2.carbon:wso2carbon-core:zip:4.2.0 (compile), org.apache.synapse:synapse-commons:jar:2.1.2-wso2v3 (compile), org.apache.synapse:synapse-nhttp-transport:jar:2.1.2-wso2v3 (compile), org.apache.synapse:synapse-pipe-transport:jar:2.1.1-wso2v4 (compile), org.apache.synapse:synapse-core:jar:2.1.2-wso2v3 (compile), org.apache.synapse:synapse-tasks:jar:2.1.2-wso2v3 (compile), org.apache.synapse:synapse-extensions:jar:2.1.2-wso2v3 (compile), org.wso2.carbon:org.wso2.carbon.mediation.initializer:jar:4.2.0 (compile), org.wso2.carbon:org.wso2.carbon.mediator.bridge:jar:4.2.0 (compile), org.wso2.carbon:org.wso2.carbon.mediation.dependency.mgt:jar:4.2.0 (compile), org.wso2.carbon:org.wso2.carbon.transport.mgt:jar:4.2.0 (compile), org.wso2.carbon:org.wso2.carbon.transport.http:jar:4.2.0