Skip to content

Instantly share code, notes, and snippets.

@matthallamew
matthallamew / curtemp
Last active September 16, 2015 15:37
Simple Groovy script to get current temperature from the command line using the Wunderground API.
#!/usr/bin/env groovy
import groovy.json.JsonSlurper;
String STATE = "CA";
String CITY = "San_Francisco";
String KEY = "YOUR_API_KEY";
JsonSlurper jsonSlurper = new JsonSlurper();
def jsonData = "http://api.wunderground.com/api/${KEY}/conditions/q/${STATE}/${CITY}.json".toURL().text;
def j = jsonSlurper.parseText(jsonData);
println """
@matthallamew
matthallamew / convertRaw.sh
Created August 29, 2015 02:05
Convert RAW images to JPG.
#!/bin/bash
for i in *.CR2;
do
fil=${i%%.CR2}
dcraw -v -o 2 -c -q 0 -w -H 8 -b 4 $i | cjpeg -quality 75 > $fil.jpg;
convert $fil.jpg -resize 1280x1024 $fil.jpg;
done
@matthallamew
matthallamew / csvTool.pl
Last active September 16, 2015 15:45
Analyze and display user defined columns from a CSV file.
#!/usr/bin/env perl
#
# Analyze CSV files in order to see only the columns you specify.
# Display the headers of the CSV in order to get column names and/or numbers.
# Use the column names/numbers in order to only display those columns to standard out.
#
use strict;
use Getopt::Std;
my %options=();
@matthallamew
matthallamew / convert.pl
Created April 9, 2015 17:03
Quick script to convert non-standard delimited list into a standard, comma-delimited list.
#!/opt/perl514/bin/perl
############################################
# Example input
# MRKT306; ACCT205/206; MGMT320/375/380/420; FNBK306
#
# Example output
# MRKT306,ACCT205,ACCT206,MGMT320,MGMT375,MGMT380,MGMT420,FNBK306
#
#############################################
$_fileName="$ARGV[0]" || "crsqual.txt";
@matthallamew
matthallamew / distancesearch.txt
Created March 10, 2015 03:22
IBM Informix stored procedure to find the distance in miles from a user supplied zipcode and number of miles.
procedure distancesearch
privilege owner
description "Returns cities,states,zips, and distances from the given zip and number of miles"
inputs inZip char(10) "inZip"
inMiles integer "inMiles"
returns char(30) "retCity"
char(2) "retSt"
@matthallamew
matthallamew / geocodeAddrs.pl
Created March 9, 2015 02:52
Perl script to geocode addresses stored in an IBM Informix database. Uses Google's geocoding API.
#!/opt/perl514/bin/perl
use DBI;
use URI::Escape;
use JSON;
use Time::HiRes qw(usleep);
use feature qw(switch);
# set delay so script doesn't reach API hits per second threshold
my $delay = 250;