Permalink
Browse files

updates

  • Loading branch information...
1 parent c828823 commit 51f00d38bbd7d2760e3f7dff62838334c0a15098 @jasonk committed Nov 3, 2011
Showing with 248 additions and 11 deletions.
  1. +7 −0 .bashrc.d/environment.sh
  2. +3 −0 .bashrc.d/vmware.sh
  3. +7 −0 .git-commit-template.txt
  4. +1 −0 .gitignore
  5. +3 −0 bin/SetTerminalStyle
  6. +46 −0 bin/SetTerminalStyle.applescript
  7. +15 −0 bin/check-dkim
  8. +11 −0 bin/dnsbl
  9. +9 −0 bin/extMerge
  10. +72 −0 bin/git-dude
  11. +3 −0 bin/git-fixup
  12. +3 −0 bin/git-rank
  13. +16 −0 bin/git-searchcommits
  14. +3 −0 bin/git-whois
  15. +4 −0 bin/p4merge
  16. +35 −0 bin/thing
  17. +4 −3 config.txt
  18. +6 −8 dotfiles
View
@@ -23,3 +23,10 @@ export FIGNORE=".o:.swp"
export PAGER=less
umask 0022
+
+function ttyreset() {
+ # Make the cursor visible if something has hidden it
+ echo -en "\033[?25h"
+ # Run the regular reset command
+ /usr/bin/reset
+}
View
@@ -0,0 +1,3 @@
+if [ -d "/Library/Application Support/VMware Fusion" ]; then
+ export PATH="$PATH:/Library/Application Support/VMware Fusion"
+fi
View
@@ -0,0 +1,7 @@
+short commit summary (<50 chars)
+# 1234567890123456789012345678901234567890
+
+More detailed commit information.
+
+* Bullet points for changelog
+
View
@@ -0,0 +1 @@
+bin/python-easy_install/
View
@@ -0,0 +1,3 @@
+#!/bin/zsh -f
+
+/usr/bin/osascript $0.applescript `/usr/bin/tty` $1
@@ -0,0 +1,46 @@
+on run {MyTTY, MySettingsName}
+ set TTYTab to my find_tab_for_tty(MyTTY)
+ if TTYTab is missing value then
+ return -- Bail if we got confused rather than making it worse
+ end if
+
+ tell application "Terminal"
+ try
+ -- Radar 7056159 Terminal's id-based reference for for
+ -- 'setting set' seems broken This was working before, but
+ -- for now, use a reference form to avoid the problem.
+ set MySettings to a reference to settings set MySettingsName
+ on error
+ -- use default settings if the name is bogus
+ set MySettings to default settings
+ end try
+
+ set current settings of TTYTab to MySettings
+ end tell
+
+end run
+
+on find_tab_for_tty(MyTTY)
+ -- Find the window/tab that has this tty. Could use an
+ -- application->tab relationship or possibbly a 'find tab by tty'
+ -- command of some sort.
+ tell application "Terminal"
+ set MyWindowCount to count of windows
+ repeat with MyWindowIndex from 1 to MyWindowCount
+ set MyWindow to window MyWindowIndex
+ try
+ set MyTabCount to count of tabs of MyWindow
+ on error
+ set MyTabCount to 0 -- a non-Terminal window?
+ end try
+ repeat with MyTabIndex from 1 to MyTabCount
+ set MyTab to tab MyTabIndex of MyWindow
+ if MyTTY is (tty of MyTab) then
+ return MyTab
+ end if
+ end repeat
+ end repeat
+ end tell
+
+ return missing value
+end find_tab_for_tty
View
@@ -0,0 +1,15 @@
+#!/usr/bin/env perl
+use strict; use warnings;
+use Mail::DKIM::Verifier;
+
+my $dkim = Mail::DKIM::Verifier->new;
+
+while ( <STDIN> ) {
+ chomp;
+ s/\015$//;
+ $dkim->PRINT( "$_\015\012" );
+}
+$dkim->CLOSE;
+
+my $result = $dkim->result;
+print "$result\n";
View
@@ -0,0 +1,11 @@
+#!/usr/bin/env perl
+use strict; use warnings;
+use Net::Blacklist::Client;
+my $rbl = Net::Blacklist::Client->new;
+for my $ip ( @ARGV ) {
+ my $result = $rbl->lookup_ip( $ip );
+ for my $key ( keys %$result ) {
+ my $res = $result->{ $key };
+ printf( "%s: %s (%s)\n", $key, $res->{a}, $res->{txt} );
+ }
+}
View
@@ -0,0 +1,9 @@
+#!/bin/sh
+if type p4merge; then
+ p4merge
+if [ -d /Applications/p4merge.app ]; then
+ /Applications/p4merge.app/Contents/MacOS/p4merge $*
+else
+ echo "No suitable merge tool found" 1>&2
+ exit 1
+fi
View
@@ -0,0 +1,72 @@
+#!/bin/bash
+#
+# git-dude - Git commit notifier
+# https://github.com/sickill/git-dude
+#
+# Copyright (C) 2011 Marcin Kulik <http://ku1ik.com/>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# Distributed under the GNU General Public License, version 2.0.
+
+interval=$(git config dude.interval)
+interval=${interval:-60}
+
+icon_path=$(git config dude.icon)
+icon_path=${icon_path:-`pwd`/icon.png}
+eval icon_path=$icon_path # to expand ~
+
+export LC_ALL=C # make sure git talks english
+
+[[ -d $1 ]] && cd $1
+
+function notify() {
+ if [ $(which notify-send 2>/dev/null) ]; then
+ notify-send -i "$1" "$2" "$3"
+ elif [ $(which growlnotify 2>/dev/null) ]; then
+ growlnotify --image "$1" -m "$3" "$2"
+ else
+ echo $2; echo $3
+ fi
+}
+
+while true; do
+ for dir_name in *; do
+ if [[ -d $dir_name ]]; then
+ repo_name=$(basename $dir_name .git)
+ cd $dir_name
+
+ changes=$(git fetch -v 2>&1 | grep -F -- '->')
+
+ while read -r line; do
+ case $line in
+ *..*)
+ commit_range=$(echo "$line" | awk '{ print $1 }')
+ branch_name=$(echo "$line" | awk '{ print $2 }')
+ commit_messages=$(git log $commit_range --pretty=format:'%s (%an)')
+ notify $icon_path "New commits in $repo_name/$branch_name" "$commit_messages"
+ ;;
+ *new*)
+ branch_name=$(echo "$line" | awk '{ print $4 }')
+ notify $icon_path "New branch $repo_name/$branch_name"
+ ;;
+ esac
+ done <<< "$changes"
+
+ cd - &>/dev/null
+ fi
+ done
+
+ sleep $interval
+done
View
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+git commit -m "fixup! $(git log -1 --format='\''%s'\'' $@)"
View
@@ -0,0 +1,3 @@
+#!/bin/sh
+# show git contributors in descending order by number of commits
+git shortlog -sn --no-merges
View
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# Search for a given string in all patches and print commit messages
+
+# examples:
+# * search for any commit that adds or removes string "foobar"
+# git searchcommits foobar
+# * search commits for string "foobar" in directory src/lib
+# git searchcommits foobar src/lib
+# * search commits for "foobar", print full diff of commit with 1 line context
+# git searchcommits foobar --pickaxe-all -U1 src/lib
+
+query="$1"
+shift;
+
+git log -S"$query" "$@"
View
@@ -0,0 +1,3 @@
+#!/bin/sh
+# search the log to try and identify an author by name
+git log -i -1 --pretty="format:%an <%ae>\n" --author="$1"
View
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+for arg; do [[ $arg = /* ]] || arg=$PWD/$arg; absargs+=("$arg"); done;
+/Applications/p4merge.app/Contents/Resources/launchp4merge "${absargs[@]}"
View
@@ -0,0 +1,35 @@
+#!/usr/bin/env perl
+use strict; use warnings;
+use WWW::Mechanize;
+use LWP::Simple qw( mirror );
+use Path::Class qw( dir file );
+
+my $basedir = dir( $ENV{ 'HOME' }, 'thingiverse' );
+my $mech = WWW::Mechanize->new;
+
+for my $id ( @ARGV ) {
+ $mech->get( "http://www.thingiverse.com/thing:$id" );
+ my $html = $mech->content;
+ $html =~ m{<title>(.*)</title>}sm;
+ my $title = $1;
+ $title =~ s/\s*\-\s*Thingiverse//;
+ my $dir = $basedir->subdir( "$id - $title" );
+ $dir->mkpath;
+ chdir( $dir );
+ $dir->file( 'index.html' )->open( 'w' )->print( $html );
+ print "TITLE: $title\n";
+
+ local $_ = $html;
+ s#\A.*<h2>Downloads</h2>\s*##sm;
+ s#\s*</td>\s*</tr>\s*</table>\s*<hr/>\s*<div id="google_ads_footer".*##sm;
+ while ( s#<table>(.*?)</table>##sm ) {
+ my $x = $1;
+ $x =~ s#<h3 class="file_info">\s*(.*)\s*</h3>##sm or next;
+ my $title = $1;
+ $title =~ s/\s+/ /g;
+ $title =~ s/^\s*|\s*$//gs;
+ $x =~ s#<a href="(/download:\d+)"##sm or next;
+ my $file = $1;
+ mirror( "http://www.thingiverse.com$1" => $title );
+ }
+}
View
@@ -1,9 +1,10 @@
.bashrc
-.bashrc.d delete
+.bashrc.d delete
.dir_colors
.gitconfig
.perlcriticrc
.profile
-.vim delete
+.vim delete
.vimrc
-bin existing
+bin existing
+.git-commit-template.txt
View
@@ -36,28 +36,26 @@ sub rsync {
system( 'rsync', '-avPH', @_ ) == 0 or die "rsync failed\n";
}
+my %argmap = (
+ delete => '--delete',
+ existing => '--existing',
+);
+
sub pull_from {
my $src = shift;
- my %argmap = (
- delete => '--delete',
- existing => '--existing',
- );
for my $key ( keys %config ) {
my @args = ();
for my $arg ( @{ $config{ $key } } ) {
if ( $argmap{ $arg } ) {
push( @args, $argmap{ $arg } );
- }
+ }
}
rsync( @args, "$src/$key", '.' );
}
}
sub push_to {
my $dest = shift;
- my %argmap = (
- delete => '--delete',
- );
for my $key ( keys %config ) {
my @args = ();
for my $arg ( @{ $config{ $key } } ) {

0 comments on commit 51f00d3

Please sign in to comment.