Skip to content

Instantly share code, notes, and snippets.

@amcclosky
amcclosky / README.md
Last active July 24, 2020 17:30 — forked from kohenkatz/generate_ulid_text.sql
UILD Utilities in PL/pgSQL

UILD for PL/pgSQL

ULID is a format for k-ordered distributed id generation. i.e. you can generate a random unique id with no central coordination and later be able to mostly sort the ids by the time they were generated.

When won't ids be sorted?

If ids are generated within the same second on different instances they could be out of order within that second.

Source of this code:

@amcclosky
amcclosky / csv_import_magic.js
Created February 16, 2016 15:57 — forked from ianlewis/csv_import_magic.js
A Google Apps Script for importing CSV data into a Google Spreadsheet.
// vim: ft=javascript:
/*jslint sloppy: true, vars: true, white: true, nomen: true, browser: true */
/*global SpreadsheetApp, UiApp, UrlFetchApp, Utilities */
/*
* A script to automate requesting data from an external url that outputs CSV data.
*
* Adapted from the Google Analytics Report Automation (magic) script.
* @author nickski15@gmail.com (Nick Mihailovski)
* @author ianmlewis@gmail.com (Ian Lewis)
*/
@amcclosky
amcclosky / sign_s3.gs
Created February 10, 2016 15:29 — forked from andsens/sign_s3.gs
Google spreadsheet function for signing S3 URLs (very handy for CSV cost allocation reports when combined with the ImportData() function)
function sign_s3(access_key, private_key, bucket, object_name, validity, base_url) {
if(!base_url) {
base_url = "http://s3.amazonaws.com";
}
if(!validity) {
validity = 60;
}
expires = Math.floor((new Date()).getTime() / 1000) + validity;
object_name = encodeURIComponent(object_name);
stringToSign = "GET\n\n\n"+expires+"\n/"+bucket+"/"+object_name;
# The following script scrapes ESPN's MLB Standings Grid and writes the
# standings for each American League (AL) team to a CSV file, which has the following
# format:
# Team, Opponent, Wins, Losses
from bs4 import BeautifulSoup
import urllib2
import re
import csv
@amcclosky
amcclosky / README
Created August 22, 2012 16:52 — forked from brutuscat/README
Anonymous Rotating Proxies with Monit, Tor, Haproxy and Delegated. Idea by http://blog.databigbang.com/running-your-own-anonymous-rotating-proxies/
0 - Read http://blog.databigbang.com/running-your-own-anonymous-rotating-proxies/
1 - Install monit, haproxy, tor and delegated.
2 - Setup your environment in the setup.rb file
3 - Just run > ruby setup.rb
4 - ...........
5 - PROFIT! > http://www.southparkstudios.com/clips/151040/the-underpants-business