Skip to content

Instantly share code, notes, and snippets.

View jaymcgavren's full-sized avatar

Jay McGavren jaymcgavren

View GitHub Profile
this is a test
#!/usr/bin/ruby
require 'fileutils'
require 'exifr'
ARGV.each do |file|
begin
date = EXIFR::JPEG.new(file).date_time_original
dir = sprintf('%04d-%02d-%02d', date.year, date.month, date.mday)
Dir.mkdir(dir) unless File.exist?(dir)
#!/usr/bin/ruby
require 'fileutils'
ARGV.each do |file|
begin
date = File.new(file).ctime
dir = sprintf('%04d-%02d-%02d', date.year, date.month, date.mday)
Dir.mkdir(dir) unless File.exist?(dir)
FileUtils.mv(file, dir)
#!/usr/bin/ruby
require 'fileutils'
ARGV.each do |file|
begin
date = File.new(file).mtime
dir = sprintf('%04d-%02d-%02d', date.year, date.month, date.mday)
Dir.mkdir(dir) unless File.exist?(dir)
FileUtils.mv(file, dir)
#!/usr/bin/ruby
input = STDIN.isatty ? nil : STDIN.read
if input
IO.popen('pbcopy', 'w').print(input)
else
puts `pbpaste`
end
#!/usr/bin/ruby
require 'utility'
file = File.open(File.join(ENV['HOME'], "events.txt"), "a")
t = Time.new
time = sprintf("%04d-%02d-%02d_%02d%02d%02d", t.year, t.month, t.day, t.hour, t.min, t.sec)
file.puts "#{time}\t#{ARGV.join(' ')}"
#!/bin/sh
curl "http://is.gd/api.php?longurl=$(echo $@ | sed 's/\ /+/g')"
#!/opt/local/bin/perl
#Get command line options.
$wrap_column = $ARGV[0] || 60;
#Set up text wrap options.
use Text::Wrap;
use Text::Tabs;
$Text::Wrap::columns = $wrap_column;
@jaymcgavren
jaymcgavren / gist:146565
Created July 14, 2009 00:31
Version of 'cb' clipboard getter/setter that should work with xfce
#!/usr/bin/ruby
require 'utility'
input = STDIN.isatty ? nil : STDIN.read
if input
IO.popen('xclip -selection clipboard', 'w').print(input)
else
puts `xclip -selection clipboard -o`
end
@jaymcgavren
jaymcgavren / gist:157908
Created July 29, 2009 07:06
Enhanced Google Search for Firefox
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>Jay's Search</ShortName>
<Description>Google search with 100 results per page and keyboard shortcuts</Description>
<InputEncoding>UTF-8</InputEncoding>
<Url type="application/x-suggestions+json" method="GET" template="http://suggestqueries.google.com/complete/search?output=firefox&amp;client=firefox&amp;hl={moz:locale}&amp;q={searchTerms}&amp;num=100&amp;esrch=BetaShortcuts"/>
<Url type="text/html" method="GET" template="http://www.google.com/search">
<Param name="q" value="{searchTerms}"/>
<Param name="ie" value="utf-8"/>
<Param name="oe" value="utf-8"/>
<Param name="aq" value="t"/>