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
stdClass Object
(
[spotInstanceRequestSet] => stdClass Object
(
[item] => Array
(
[0] => stdClass Object
(
[createTime] => 2010-02-02T21:58:25.000Z
[launchGroup] => BraderTest
import bisect
class NFA(object):
EPSILON = object()
ANY = object()
def __init__(self, start_state):
self.transitions = {}
self.final_states = set()
self._start_state = start_state
@snay2
snay2 / funcs.py
Created March 3, 2011 22:21
Examples using SQS
import uuid
import time
import boto
import json
from boto.sqs.message import RawMessage
AWSKey = "{redacted}"
AWSSecret = "{redacted}"
testQueue = "testqueue"
@marcelcaraciolo
marcelcaraciolo / tf_idf_final.py
Created January 13, 2012 03:38
tf-idf example
#-*- coding: utf-8 -*-
import re
import nltk
from nltk.tokenize import RegexpTokenizer
from nltk import bigrams, trigrams
import math
stopwords = nltk.corpus.stopwords.words('portuguese')
@jwills
jwills / gist:2047314
Created March 15, 2012 22:13
Pagerank in Pig
#!/usr/bin/python
from org.apache.pig.scripting import *
INIT = Pig.compile("""
A = LOAD 'page_links_en.nt.bz2' using PigStorage(' ') as (url:chararray, p:chararray, link:chararray);
B = GROUP A by url;
C = foreach B generate group as url, 1 as pagerank, A.link as links;
STORE C into '$docs_in';
""")
@robbyt
robbyt / spot_price.py
Created March 19, 2012 02:22
find standard average (mean) ec2 spot instance price
import boto
#type that you want to get pricing on
MY_TYPE = u'm1.small'
ec2 = boto.connect_ec2()
spots = ec2.get_spot_price_history(instance_type= MY_TYPE)
spot_prices = [i.price for i in spots]
@hidayat365
hidayat365 / crosstab.sql
Last active October 8, 2021 07:17
MySQL CrossTab
PS C:\Users\hiday> mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 26
Server version: 10.5.7-MariaDB-log mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use test
@leighmacdonald
leighmacdonald / import_geo.py
Created June 7, 2012 19:46
MaxMind normalized Import Script
#!/usr/bin/python
from __future__ import print_function
from sys import exit
from logging import getLogger, DEBUG, INFO, basicConfig
from urllib2 import urlopen, HTTPError
from urllib import urlretrieve
from gzip import open as gzopen
from datetime import datetime
from collections import defaultdict
from zipfile import ZipFile, is_zipfile
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active October 30, 2024 16:09
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@pcreux
pcreux / complete.sh
Created February 18, 2013 10:20
Github Commit Status API with Bamboo from Atlassian. Add those to your plan as Script.
# specs and cukes results are stored in JUnit format under test-reports
if (grep 'failures="[^0]"' test-reports/* || grep 'errors="[^0]"' test-reports/*); then
curl -H "Authorization: token MY_TOKEN" --request POST --data '{"state": "failure", "description": "Failed!", "target_url": "${bamboo.buildResultsUrl}"}' https://api.github.com/repos/USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null
else
curl -H "Authorization: token MY_TOKEN" --request POST --data '{"state": "success", "description": "Success!", "target_url": "${bamboo.buildResultsUrl}"}' https://api.github.com/repos/USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null
fi