Skip to content

Instantly share code, notes, and snippets.

@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 10, 2025 09:21
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@ptwobrussell
ptwobrussell / Helper Code for Saving LinkedIn Contacts to a Remote VM
Created October 28, 2013 03:47
If you are running on a hosted AWS VM provided for the Strata workshop, you'll need to use the following approach to follow along with Example 6 and on, because you aren't using Vagrant and won't have another way to copy your data onto the remote machine. All you'll need to do is create a new cell in the "Chapter 3 (Mining LinkedIn)" IPython Not…
# On a remote AWS VM, you'll need to create and save your
# CSV connections to the the remote VM before executing Example 6
# since you're not using Vagrant (and since we won't be using SSH
# as part of the workshop.)
# Copy/paste your connections (or a large subset of them) into a string value
# that's bounded by triple quotes like the following example (which defines only
# a single contact for brevity.)
csv_as_string = \
@pedroha
pedroha / gist:5758125
Created June 11, 2013 15:59
Introduction to Front-End Technologies
# MAC manipulators
alias random_mac='sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`'
alias restore_mac='sudo ifconfig en0 ether YOUR_ORIGINAL_MAC_ADDRESS_GOES_HERE'
require 'sinatra'
require 'sanitize'
TO_REMOVE = ["", " ", " "]
get '/' do
<<-HTML
<form method="post" action="sanitize">
<textarea name="dirty" style="width:100%;height:800px;"></textarea>
<input type="submit" value="Submit">
@ascheink
ascheink / gitmo-splash.rb
Last active December 13, 2015 20:08
Code to quickly create a mosaic image of the faces of the detainees still in Gitmo http://i.imgur.com/tIqdGtH.jpg
require 'nokogiri'
require 'httparty'
puts "Scraping ids of detainees in custody"
ids = []
(1..10).each do |n|
response = HTTParty.get "http://projects.nytimes.com/guantanamo/detainees/held?page=#{n}"
page = Nokogiri::HTML(response)
ids += page.css('#detaineesTable a').map { |link| $1 if /detainees\/(\d+)/ =~ link['href'] }.compact
end
@kellan
kellan / cfda.json
Created February 2, 2013 23:18
The members of Council of Fashion Designers as a JSON blob. From #fashionhack hackathon.
[{"name":"Amsale Aberra","photo":"http:\/\/cfda.com\/wp-content\/uploads\/2012\/05\/Amsale-Image-400x600.jpg","cfda":"http:\/\/cfda.com\/designer\/amsale-aberra-2","website":"http:\/\/www.amsale.com","facebook":"http:\/\/www.facebook.com\/pages\/Amsale\/11144370697","twitter":"http:\/\/www.twitter.com\/amsalebridal","pinterest":null,"tumblr":null,"blog":null},{"name":"Reem Acra","photo":"http:\/\/cfda.com\/wp-content\/uploads\/2012\/05\/IMG_7440-400x600.jpg","cfda":"http:\/\/cfda.com\/designer\/reem-acra","website":"http:\/\/www.reemacra.com","facebook":"http:\/\/facebook.com\/ReemAcraNY","twitter":"http:\/\/twitter.com\/#!\/Reem_Acra","pinterest":null,"tumblr":null,"blog":null},{"name":"Alexa Adams","photo":"http:\/\/cfda.com\/wp-content\/uploads\/2012\/05\/IMG_2736_\u00c2\u00a9darrenhall_2012-Edit-400x314.jpg","cfda":"http:\/\/cfda.com\/designer\/alexa-adams","website":"http:\/\/www.ohnetitel.com","facebook":"http:\/\/www.facebook.com\/#!\/pages\/Ohne-Titel\/207828522597900","twitter":null,"pinterest":null,
@mattb
mattb / gist:4588259
Created January 21, 2013 18:44
Source code used to produce https://gist.github.com/4588234
ids = [293401191054979074, 293401663698513921, 293401787464040448, 293401934436659200, 293402177140056064, 293402218432983040, 293402263777587202, 293402332853583872, 293402393025077250, 293402466354077698, 293402940637597696, 293403039295995904, 293403262642700288, 293403304124366848, 293403623084404737, 293403854266048512, 293403891633094656, 293404203659964416, 293404415535239168, 293404447453872128, 293404518945783808, 293404594669760512, 293404694401929217, 293405000087003137, 293405024229404673, 293405072929484800, 293405372021108736, 293405406661857281, 293405547682734080, 293405590468845570]
count = ids.size
tweets = ids.map { |i|
puts count
count -= 1
tweet = Twitter.status(i).to_hash
activity = Twitter.status_activity(i).to_hash
tweet.merge(activity)
}
open("tweets.json","w" ) { |f|
@mattb
mattb / gist:4588234
Last active December 11, 2015 10:38
Count of retweets plus favourites of @BarackObama's key phrases from the 2013 US Inauguration (one asterisk = 500 retweets+favourites) as of 10:42am PST on January 21st 2013. Source code: https://gist.github.com/4588259
************************************************* Our journey is not complete until our gay brothers and sisters are treated like anyone else under the law. (6699fav/17845rt)
************************** Our journey is not complete until our wives, our mothers, and daughters can earn a living equal to their efforts. (3059fav/9974rt)
**************** Thank you, God Bless you, and may He forever bless these United States of America. (2191fav/5866rt)
*************** Our journey is not complete until all our children know that they are cared for, and cherished, and always safe from harm. (1743fav/5970rt)
************* Our journey is not complete until we find a better way to welcome the immigrants who still see America as a land of opportunity. (1774fav/5016rt)
************ We have always understood that when times change, so must we. —President Obama (1422fav/5049rt)
************ We, the people, declare today that the most evident of truths—that all of us are created equal—is the star that guides us still. (1418fa
@selenamarie
selenamarie / a_better_opml.py
Last active December 11, 2015 09:59
This grabs URLs associated with the people you follow on Twitter and then tries to scrape RSS feeds from the URLs. You have to get OAUTH creds from dev.twitter.com/apps to do this, and then register the script so that you get the access_token + access_token_secret. Rev 2 actually produces valid OPML. ;)
#!/usr/bin/env python
import tweepy
from BeautifulSoup import BeautifulSoup as parser
import urllib
import sys
import argparse
import ConfigParser