This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Copyright (c) Paul R. Tagliamonte <[email protected]>, 2012, under the | |
; terms of dput-ng it's self. | |
(ns clojtest | |
(:require dput.core | |
dput.exceptions)) | |
(defn log [x] ; for debug output | |
(.debug dput.core/logger x)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bpython -i | |
from sunlight import * | |
import json | |
import sys | |
if '--local' in sys.argv: | |
import sunlight.services.openstates | |
sunlight.services.openstates.service_url = 'http://localhost:8000/api/v1' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns sunup | |
(:require sunlight)) | |
(defn frequencies [coll] | |
(reduce (fn [counts x] (assoc counts x (inc (get counts x 0)))) {} coll)) | |
(frequencies | |
(for [l (kwapply | |
(.-legislators sunlight/openstates) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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%' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This script pulls from the Sunlight Labs "openstates" API | |
to get information about legislators at the state level, | |
do a count of their party affiliations, | |
and return that information as | |
1) a JSON object for visualizations | |
2) a table suitable for embed into an HTML page | |
Information about the specific API used can be found here: | |
http://python-sunlight.readthedocs.org/en/latest/services/openstates.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main ( int argc, char ** argv ) { | |
char msg[] = { | |
0x1B, '[', '2', 'J', 0x1B, '[', 'H', '\0' | |
}; | |
std::cout << msg; | |
} |
NewerOlder