Skip to content

Instantly share code, notes, and snippets.

View cerdman's full-sized avatar

colin b. erdman cerdman

  • TriNetX Inc.
  • United States
View GitHub Profile
@cerdman
cerdman / freshstart
Last active August 29, 2015 14:10 — forked from dbogart/freshstart
//stops all files in root directory from being tracked in git
git rm --cached . -r
//if you need to modify .gitignore, or create it again because it disappeared, do it before the next command
//tracks all files except those in .gitignore
git add .
//commit
git commit -m 'commit message'
[{"name":"Bears","color":"Blue","position":{"x":177,"y":85},"modelclass":"Bear","increment":false,"timestamp":false,"softdelete":false,"column":[{"colid":"c217","name":"id","type":"increments","length":"0","order":0,"defaultvalue":"","enumvalue":""},{"colid":"c218","name":"name","type":"string","length":"200","order":1,"defaultvalue":"","enumvalue":""},{"colid":"c219","name":"danger_level","type":"string","length":"200","order":2,"defaultvalue":"","enumvalue":""}],"relation":[{"extramethods":"","foreignkeys":"","name":"fish","relatedmodel":"Fish","relationtype":"hasOne","usenamespace":""},{"extramethods":"","foreignkeys":"","name":"trees","relatedmodel":"Trees","relationtype":"hasMany","usenamespace":""},{"extramethods":"","foreignkeys":"bear_id, picnic_id","name":"picnics","relatedmodel":"Picnics","relationtype":"belongsToMany","usenamespace":""}],"seeding":[]},{"name":"Fish","color":"Yellow","position":{"x":1063,"y":14},"modelclass":"Fish","increment":false,"timestamp":false,"softdelete":false,"column":[{"c
import luigi
import tempfile
import datetime
from luigi.contrib import rdbms
from lib.luigi import logger
from luigi.postgres import MultiReplacer
try:
import MySQLdb
import luigi
import os
#from WorkflowUtils import WorkflowUtils
import logging as log
class ATask(luigi.Task):
# Task parameters
dataset_name = luigi.Parameter()
upstream_task = luigi.Parameter()
#!/bin/bash
SNAPID="SNAP"
BACKUPDBID="TEMPDB"
#config groups
SECURITYGROUP="Mysecgrup"
PARAMSGROUP="Myparamsgrup"
#rds verifying commands

After provisioning an EC2 instance and opening up HTTP traffic, here are the commands I ran via ssh:

sudo yum install httpd

sudo apachectl start

sudo yum install R

which R

@cerdman
cerdman / CsvRow_pivotTable.r
Last active December 31, 2015 19:29
Quickly create a pivot table from a row based key-attribute-value type output from mysql or excel, using R and reshape2.
library(reshape2)
counts_byCategory_byDate <- read.csv("C:/weber_drugCounts_byReporter.csv")
a<-counts_byCategory_byDate
#check that data is there using head()
head(a,3)
#SHOULD SEE OUTPUT LIKE SIMPLE EXAMPLE HERE
#ID end_dt termName c_result_cnt termCode
# Protodash
class Instance(Resource):
resource_type = "instance"
metric_resource_type = resource_type
api_key = "instances"
id_key = "instance_id"
metric_id_key = "instance" #our resource ids are chaos
metric_column = "InstanceMetric"
import boto, datetime, time
# Enter your AWS credentials
aws_key = "YOUR_AWS_KEY"
aws_secret = "YOUR_AWS_SECRET"
# Details of instance & time range you want to find spot prices for
instanceType = 'm1.xlarge'
startTime = '2012-07-01T21:14:45.000Z'
endTime = '2012-07-30T23:14:45.000Z'
@cerdman
cerdman / spot.py
Created December 11, 2013 18:19 — forked from tristanwietsma/spot.py
import os
import boto.ec2.connection as boto
AWS_ACCESS_KEY = os.getenv('AWS_ACCESS_KEY')
AWS_SECRET_KEY = os.getenv('AWS_SECRET_KEY')
conn = boto.EC2Connection(aws_access_key_id=AWS_ACCESS_KEY, aws_secret_access_key=AWS_SECRET_KEY)
results = conn.get_spot_price_history( instance_type='cg1.4xlarge', product_description='Linux/UNIX')
for r in results: