Skip to content

Instantly share code, notes, and snippets.

View michael-erasmus's full-sized avatar

Michael Erasmus michael-erasmus

View GitHub Profile
@tdhopper
tdhopper / gist:6356555
Last active December 21, 2015 19:49
Code for unshortening a list of shortened URLs using unshort.me and unshorten.it's APIs.
# Used for unshortening list of urls as wel as checking the HTTP status code of a webpage.
# When called from the command line, requires either a filename or STDIN as input
# Filename or standard input should contain one URL per line
# Output is printed to the standard out and saved to a JSON file using PickleDB.
__author__ = "Tim Hopper"
__email__ = "[email protected]"
import fileinput
import urllib2
@thbar
thbar / Guardfile
Last active December 15, 2015 10:28
How to automatically restart the simulator in RubyMotion when code is updated (beta version!)
require 'childprocess'
guard 'shell' do
watch %r{^app/(.+)\.rb$} do |m|
`killall rake`
# Why this:
# - spawn a child process to avoid locking Guard
# - make sure that the child process has stdout and stdin otherwise it crashes
# - bonus point: get REPL access in the simulator!
@jeremykarn
jeremykarn / mongo pig schema generator
Last active December 11, 2015 13:38
The Pig and Python scripts for a Mortar web project that generates the MongoLoader schema associated with a Mongo collection. Need to supply your own MongoDB connection details and your own s3 bucket.
#
# Copyright 2012 Mortar Data Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@hubgit
hubgit / curl-verbose.php
Created December 2, 2011 16:40
Verbose cURL in PHP
<?php
// Request URL
$url = 'http://www.google.com/';
// HTTP headers
$headers = array(
//'Content-Type: application/json',
//'Accept: application/json',
);