Skip to content

Instantly share code, notes, and snippets.

View rosskarchner's full-sized avatar
🤘
ROLLBACK_COMPLETE

Ross M Karchner rosskarchner

🤘
ROLLBACK_COMPLETE
View GitHub Profile
@rosskarchner
rosskarchner / export.py
Created February 21, 2011 22:48
extract tiles from an mbtiles file
import sqlite3, os
conn = sqlite3.connect('Mills1860.mbtiles')
results=conn.execute('select * from tiles').fetchall()
for result in results:
zoom, column, row, png= result
try:
os.makedirs('%s/%s/' % (zoom, row))
var eightteensixtyOptions = {
getTileUrl: function(coord, zoom) {
return "/1860/tiles-1860/" + zoom +"/" + coord.x+"/"+coord.y+ ".png";
},
tileSize: new google.maps.Size(256, 256),
isPng: true,
maxZoom:14,
minZoom:10,
name:"What",
$('a[href$=.pdf]').click(function(){
if(pageTracker){
var fixedLink = this.href;
fixedLink = fixedLink.replace(/https?:\/\/(.*)/,"$1");
fixedLink = '/downloads/' + fixedLink;
pageTracker._trackPageview(fixedLink);
if(console){
console.log('page tracked: ' + fixedLink);
}
};
@rosskarchner
rosskarchner / gist:967562
Created May 11, 2011 22:47
Saves the visible page in Chrome as a full-page screenshot, in Evernote, via the freeware Paparazzi! app
on run {input, parameters}
tell application "Google Chrome"
set myURL to URL of active tab of window 1
set myTitle to title of active tab of window 1
end tell
tell application "Paparazzi!"
capture myURL min size {1024, 728}
@rosskarchner
rosskarchner / gist:1001799
Created June 1, 2011 04:43
Script that adds OpenMeta tags to Pukka cache
#! /usr/bin/python
#requires: openmeta command line tool, openmeta python library
from glob import glob
from plistlib import readPlistFromString
import shlex, subprocess, openmeta
get_xml="plutil -convert xml1 -o - %s"
@rosskarchner
rosskarchner / gist:1005705
Created June 3, 2011 01:37
In Automator, service to bookmark current Chrome tab in Pukka
on run {input, parameters}
tell application "Google Chrome"
set myURL to URL of active tab of window 1
set myTitle to title of active tab of window 1
end tell
tell application "Pukka"
set post URL to myURL
@rosskarchner
rosskarchner / gist:1831953
Created February 15, 2012 00:14
CooksIllustrated.com recipe database to Evernote
import mechanize, codecs
from BeautifulSoup import BeautifulSoup, Comment
ci_login_url="https://auth.cooksillustrated.com/"
recipe_search_root="http://www.cooksillustrated.com/search/results.asp"
initial_query='?query=+&filters=&sort=&filters=type:Recipe'
br = mechanize.Browser()
br.open(ci_login_url)
@rosskarchner
rosskarchner / gist:2872155
Created June 5, 2012 02:30
This ical (valid according to http://icalvalid.cloudapp.net/ and http://severinghaus.org/projects/icv/) can't be parsed by collective.icalendar
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Meetup//RemoteApi//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-ORIGINAL-URL:http://www.meetup.com/DevOpsDC/events/ical/DevOpsDC/
X-WR-CALNAME:Events - DevOpsDC
BEGIN:VTIMEZONE
TZID:America/New_York
TZURL:http://tzurl.org/zoneinfo-outlook/America/New_York
@rosskarchner
rosskarchner / gist:9191085
Created February 24, 2014 16:00
Declaring bookmark bankruptcy, I wanted to clear out my xmarks account. There's no built in way, but running this in the javascript console (while viewing my.xmarks.com) seems to work.
function start() {
Foxmarks.BookmarkManager.removeSelectedNode()
setTimeout(start, 2000);
}
start();
import adnpy
import sys
# Set the default access token for API calls.
adnpy.api.add_authorization_token('AQAAAAAACqdtFdqwsJmFbaDL036aIM8RDgQKvbDhXBfFJRMl0IQkurrGfBROJQ5Qx0mEf0oYYdnecAyEZR29jgkEPUTaPes_zg')
while True:
try:
text = raw_input('> ')
if text: