This file contains 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
//imports | |
var fs = require('fs'), | |
path = require('path'), | |
irc = require('irc-js'), | |
//redis = require('redis').createClient(); | |
mongo = require('mongodb'), | |
db = new mongo.Db('wikis', new mongo.Server('localhost', 27017, {}), {}); | |
function listen(config, callback){ |
This file contains 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
//imports | |
var fs = require('fs'), | |
path = require('path'), | |
irc = require('irc-js'), | |
nodeio = require('node.io'), | |
//redis = require('redis').createClient(); | |
mongo = require('mongodb'), | |
db = new mongo.Db('wikis', new mongo.Server('localhost', 27017, {}), {}); |
This file contains 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
var map; | |
var pointsLayer; | |
$(document).ready(function () { | |
map = new L.Map('mapContainer'); | |
var url = 'http://{s}.tiles.mapbox.com/v3/mapbox.mapbox-streets/{z}/{x}/{y}.png'; | |
var copyright = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade'; | |
var tileLayer = new L.TileLayer(url, { | |
attribution: copyright | |
}); | |
var startPosition = new L.LatLng(41.883333, - 87.633333); |
This file contains 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
import sys | |
import time | |
if len(sys.argv) < 2: | |
print("You need to tell me how many problems you have for which you are trying to apply regex as a solution") | |
print("run script as `python addregex.py <no. of problems>`") | |
sys.exit() | |
problems = int(sys.argv[1]) |
This file contains 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
ffmpeg -i "put_url_here" -vf fps=1/15 img_%03d.jpg && montage -geometry +4+4 img_* output.png |
This file contains 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/env python | |
from subprocess import PIPE, Popen | |
import argparse | |
import os | |
''' | |
Give me a url to a video file and I will return a thumbnail preview | |
Run me like: `python thumbnailgen.py -i https://catalog.archives.gov/OpaAPI/media/13729/content/arcmedia/mopix/107/107-1130.wmv?download=true` |
This file contains 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
def leftJoinCSV(file1, file2, *args): | |
'''Really should only be used to left join two csv files. Left file is first arg, right file is second arg. | |
Column(s) title (string in the head) are the third and fourth args''' | |
if len(args) > 1: | |
'''can either enter one column for both or each one ''' | |
column1 = args[0] | |
column2 = args[1] | |
elif len(args) == 1: | |
column1 = args[0] | |
column2 = args[0] |
This file contains 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
'''you have a csv file with something like: | |
col1, col2 | |
x, 1 | |
x, 2 | |
y, 1 | |
z, 4 | |
z, 8 | |
and you want to output something like: | |
col1, col2 | |
x, 1;2 |
This file contains 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
import csv, requests | |
with open('./canonical_datasets_nycopen_07NOV2016.csv', 'w') as w: | |
writer = csv.writer(w) | |
writer.writerow(['access', 'issued', 'modified', 'publisher', 'title', 'location', 'identifier', 'id', 'theme', 'description']) | |
data_location = 'https://nycopendata.socrata.com/data.json' | |
res = requests.get(data_location) | |
data = res.json() | |
datasets = data['dataset'] | |
for d in datasets: |
This file contains 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
'''SOMETIMES YOU WANT SOME SCRAMBLED CSVs: python scrambled_csv.py <path_to_csv_file>''' | |
import csv, random | |
import sys | |
def scrambler(head, cols): | |
scrambled = [] |
OlderNewer