Skip to content

Instantly share code, notes, and snippets.

View grantwinney's full-sized avatar

Grant grantwinney

View GitHub Profile
@grantwinney
grantwinney / url-updater.py
Last active June 20, 2018 17:12
Reads in a list of URLs (from a CSV file), writes any redirected URLs to a new CSV file, and prints out missing (404) URLs to the console
import csv
import urllib2
with open('urls.csv', 'rb') as f:
reader = csv.reader(f)
with open('urls-output.csv', 'w') as g:
writer = csv.writer(g, delimiter=',')
for row in reader:
url = row[0]
try:
@grantwinney
grantwinney / ghost_edit_bookmarklet.txt
Last active April 13, 2018 13:51
A little "edit page" bookmarklet if you're using the Ghost blog. Redirects URL to /edit. Just save it as a new bookmark.
javascript:let%20u=window.location.href;if(u.indexOf('grantwinney.com')!==-1&&!(u.endsWith('.com/'))&&u.indexOf('ghost/#/editor')===-1){window.location.href=window.location.protocol+window.location.pathname+'/edit';}
@grantwinney
grantwinney / scaling.erl
Created April 24, 2017 02:25
Small example of scaling up processes to handle an increased workload
-module(scaling).
-export([start_router/0, init_router/0, process_message/1]).
-define(MESSAGE_LIMIT, 3).
start_router() ->
register(scaling, spawn(scaling, init_router, [])).
init_router() ->