Skip to content

Instantly share code, notes, and snippets.

View spudtrooper's full-sized avatar

Jeff Palm spudtrooper

View GitHub Profile
@spudtrooper
spudtrooper / macinstall
Created May 30, 2011 12:13
Tries to install something using fink, macports, and apt-get.
#!/bin/sh
#
# Tries to install something using fink, macports, and apt-get.
#
cmds="fink port apt-get"
for c in $cmds; do
test x`which $c` != 'x' && {
$c install $@
test "$?" -eq "0" && exit 1
@spudtrooper
spudtrooper / Cygwin.bat
Created June 8, 2011 17:35
cygwin that doesn't suck as much
@echo off
C:
cd c:\cygwin\bin
REM bash -login -i
rxvt -km ISO-8859-15 -sl 2500 -sb -geometry 90x30 -tn rxvt -fn 'Lucida Console-14' -sr -e /usr/bin/bash --login -i
@spudtrooper
spudtrooper / print_possible_printer_ports
Created August 18, 2011 15:58
Print possible printer ports
#!/bin/sh
awk -F/ '/tcp.*print|print.*tcp/ {gsub(/.*[ \t]/,"",$1); print $1}' /etc/services
@spudtrooper
spudtrooper / ebaypages.js
Created August 21, 2011 01:27
Ebay pages -- display the first item in a paginated ebay search, so you can jump into the desired section of the search results.
//
// Displays a window listing the first item in every page for a
// paginated ebay query. This allows you to jump into the desired
// section of en ebay query, rather than browsing through pages and
// pages. For example, you search for an item yielding 1000s of pages
// of results with bidding periods ranging from seconds to days, and
// you're willing to wait a couple days -- so you sort by 'time left'.
// Instead of clicking through the pages until you find the results
// that have a couple days, you could directly to that page. There is
// more here:
@spudtrooper
spudtrooper / search_jars
Created August 27, 2011 18:57
Searches a list of jar files for a given package or class
#!/bin/sh
#
# Searches a list of jar files for a given package or class and prints
# the jar file that contains files in that package. The first
# argument is the package for which we search, the rest are jar files
# to search. Examples searching for a (1) package and (2) class:
#
# search_jars org.apache.http *.jar # (1)
# search_jars HttpExecutionContext *.jar # (2)
#
@spudtrooper
spudtrooper / check_for_video_experimenter
Created August 28, 2011 20:53
Mails the USER or email you pass in if the video experimenter from # nootropicdesign.com is back in stock
#!/bin/sh
#
# Mails the USER or email you pass in if the video experimenter from
# nootropicdesign.com is back in stock. Put this in your crontab to
# periodically check.
#
to=$1
to=${to:=$USER}
link="http://nootropicdesign.com/store/index.php?main_page=product_info&cPath=1&products_id=24"
res=$(curl -s $link | grep -l "Out of Stock")
@spudtrooper
spudtrooper / download_gallery_photos
Created September 1, 2011 13:10
Download the photos (skipping sized and thumbnails) # in a phpAlbum photo gallery
@spudtrooper
spudtrooper / googleCorrelateDraw.js
Created September 3, 2011 17:31
Plots functions over a domain of 2*PI on * http://www.google.com/trends/correlate/draw.
/**
* Plots functions over a domain of 2*PI on
* http://www.google.com/trends/correlate/draw.
*
* More here:
*
* http://www.jeffpalm.com/blog/archives/002216.html
*/
(function() {
@spudtrooper
spudtrooper / create_playlists_from_artists_for_rdio
Created October 2, 2011 17:23
Creates a playlist for every artist in your library -- since the Roku app doesn't have browsing by artists.
#!/usr/bin/env ruby
#
# Creates a playlist for every artist in your library -- since the
# Roku app doesn't have browsing by artists. The following need to be
# in the ENV:
#
# export RDIO_KEY=...
# export RDIO_SECRET=...
#
# You have to install the rdio gem, too.
@spudtrooper
spudtrooper / foursquareShowOnMap.js
Created October 10, 2011 02:55
Opens a foursquare location in google maps
(function() {
var html = String(document.body.innerHTML);
var res = html.match(/GLatLng\s*\(\s*(-?\d+\.?\d*)\s*,\s*(-?\d+\.?\d*)\s*\)/);
if (res) {
var lat = res[1], lng = res[2];
var title = document.getElementsByTagName('h1')[0].innerHTML;
var link = 'http://maps.google.com/maps?q='
+ escape(title) + '@' + lat + ',' + lng;
window.open(link,'_');
} else {