diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-04-11 19:01:35 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-04-11 19:06:04 -0500 |
commit | ecaf342099d0db3e3e16b0efa84b028293633774 (patch) | |
tree | 98deb33034e942410104a43b8a538f26dfd997db /bin | |
parent | bd7be041069f5124a69e98fd00ad3d94d960adae (diff) | |
download | conf-ecaf342099d0db3e3e16b0efa84b028293633774.tar.gz conf-ecaf342099d0db3e3e16b0efa84b028293633774.zip |
remove a lot of stuff i don't use anymore
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/alarm | 29 | ||||
-rwxr-xr-x | bin/build-vim | 70 | ||||
-rwxr-xr-x | bin/git/git-hub | 239 | ||||
-rwxr-xr-x | bin/git/git-jump | 69 | ||||
-rwxr-xr-x | bin/ipod_movie | 18 | ||||
-rwxr-xr-x | bin/keyboard-swarp | 65 | ||||
-rwxr-xr-x | bin/playcd | 14 | ||||
-rwxr-xr-x | bin/procmem | 67 | ||||
-rwxr-xr-x | bin/show_colors (renamed from bin/colors) | 0 |
9 files changed, 0 insertions, 571 deletions
diff --git a/bin/alarm b/bin/alarm deleted file mode 100755 index d247c58..0000000 --- a/bin/alarm +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -reset_mixer() -{ - amixer set Master $OLDVOL_M $M > /dev/null - amixer set PCM $OLDVOL_P $P > /dev/null -} - -set_mixer() -{ - OLDVOL_M=`amixer get Master | egrep "$Front Left.*\[.*%\]" | sed s/".*\[\(.*%\)].*"/"\1"/` - OLDVOL_P=`amixer get PCM | egrep "$Front Left.*\[.*%\]" | sed s/".*\[\(.*%\)].*"/"\1"/` - OLDMUTE_M=`amixer get Master | egrep "$Front Left.*\[.*%\]" | sed s/".*\[\(.*%\)].*\[\(.*\)\]"/"\2"/` - OLDMUTE_P=`amixer get PCM | egrep "$Front Left.*\[.*%\]" | sed s/".*\[\(.*%\)].*\[\(.*\)\]"/"\2"/` - echo $OLDMUTE_M | grep -q on || M='mute' - echo $OLDMUTE_P | grep -q on || P='mute' - amixer set Master 100% unmute > /dev/null - amixer set PCM 100% unmute > /dev/null -} - -trap reset_mixer 2 -trap reset_mixer 3 -trap reset_mixer 15 -for i in {1..100};do - set_mixer - mplayer ~/.alarm.mp3 > /dev/null - reset_mixer - sleep 600 -done -reset_mixer diff --git a/bin/build-vim b/bin/build-vim deleted file mode 100755 index 508e52c..0000000 --- a/bin/build-vim +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -PREFIX=/usr/local -BUILDDIR="${PWD}/.build" -SRCDIR="${BUILDDIR}${PREFIX}" -echo "Building with: PREFIX=$PREFIX BUILDDIR=$BUILDDIR SRCDIR=$SRCDIR" - -OPTS="--prefix=${PREFIX} --localstatedir=/var/lib/vim --mandir=${PREFIX}/share/man --with-features=big --disable-gpm --enable-acl --with-x=yes --enable-multibyte --enable-cscope --enable-perlinterp" -echo "Configure options: $OPTS" - - -mkdir -p $BUILDDIR || exit 1 - -make distclean || exit 1 -./configure $OPTS || exit 1 -make || exit 1 -make DESTDIR=$BUILDDIR install || exit 1 - -pushd ${SRCDIR}/bin || exit 1 - rm -f ex view || exit 1 - mv vim vim-normal || exit 1 - ln -sf vim-normal vim || exit 1 - ln -sf vim-normal rview || exit 1 - ln -sf vim-normal rvim || exit 1 - ln -sf vim-normal vimdiff || exit 1 -popd || exit 1 - -find ${SRCDIR}/share/man -type d -name 'man1' 2> /dev/null | \ - while read _mandir; do - pushd ${_mandir} || exit 1 - rm -f ex.1 view.1 || exit 1 - rm -f evim.1 || exit 1 - popd || exit 1 - done - -sudo rsync -av ${SRCDIR}/ $PREFIX || exit 1 - -rm -rf $BUILDDIR || exit 1 -mkdir -p $BUILDDIR || exit 1 - -make distclean || exit 1 -./configure $OPTS --enable-gui=gtk2 || exit 1 -make || exit 1 -make DESTDIR=$BUILDDIR install || exit 1 - -pushd ${SRCDIR}/bin || exit 1 - rm -f xxd ex view vimtutor vimdiff rview rvim || exit 1 - mv vim vim-big || exit 1 - ln -sf vim-big eview || exit 1 - ln -sf vim-big evim || exit 1 - ln -sf vim-big gview || exit 1 - ln -sf vim-big gvim || exit 1 - ln -sf vim-big gvimdiff || exit 1 - ln -sf vim-big rgview || exit 1 - ln -sf vim-big rgvim || exit 1 -popd || exit 1 - -find ${SRCDIR}/share/man -type d -name 'man1' 2> /dev/null | \ - while read _mandir; do - pushd ${_mandir} || exit 1 - rm -f ex.1 view.1 || exit 1 - rm -f rvim.1 rview.1 vim.1 vimtutor.1 vimdiff.1 xxd.1 || exit 1 - popd || exit 1 - done - -rm -rf ${SRCDIR}/share/vim || exit 1 - -sudo rsync -av ${SRCDIR}/ $PREFIX || exit 1 - -rm -rf $BUILDDIR || exit 1 diff --git a/bin/git/git-hub b/bin/git/git-hub deleted file mode 100755 index 86c7955..0000000 --- a/bin/git/git-hub +++ /dev/null @@ -1,239 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; - -package App::Git::Hub; - -use File::pushd; -use List::MoreUtils qw(any); -use Net::GitHub::V2; - -sub git { - if (wantarray) { - chomp(my @ret = qx{git $_[0]}); - return @ret; - } - else { - chomp(my $ret = qx{git $_[0]}); - return $ret; - } -} - -sub new { - my $class = shift; - my @argv = @_; - - bless { - argv => \@argv, - }, $class; -} - -sub user { shift->_github->login } -sub argv { @{ shift->{argv} } } - -sub shift_argv { - my $self = shift; - return shift @{ $self->{argv} }; -} - -sub run { - my $self = shift; - - my $command = $self->shift_argv; - $self->usage unless defined $command; - $self->run_command($command); -} - -sub usage { - my @subcommands = do { no strict 'refs'; grep { /^run_command_/ } keys %{ __PACKAGE__ . '::' } }; - die "usage: git hub <subcommand> [args...]\n" - . "subcommands:\n" - . " " . (join "\n ", map { s/^run_command_//; $_ } @subcommands) - . "\n"; -} - -sub run_command { - my $self = shift; - my ($command) = @_; - - my $meth = "run_command_$command"; - if ($self->can($meth)) { - return $self->$meth($self->argv); - } - else { - $self->usage; - } -} - -sub run_command_create { - my $self = shift; - my ($name, $description, $url) = @_; - die "usage: git hub create <name> <description> [url]" - unless @_ >= 2; - - $self->_github(repo => $name)->repos->create( - $name, $description, $url || '', 1 - ); -} - -sub run_command_delete { - my $self = shift; - die "usage: git hub delete [-f] <name>" - unless @_ == 1 || @_ == 2; - - my $force; - if ($_[0] eq '-f') { - $force = 1; - shift @_; - } - - my ($name) = @_; - - warn "not actually deleting $name (-f not set)\n" unless $force; - - $self->_github(repo => $name)->repos->delete( - $force ? ({confirm => 1}) : () - ); -} - -sub run_command_fork { - my $self = shift; - my ($owner, $repo) = @_; - die "usage: git hub fork <owner> <repo>" - unless @_ == 2; - - $self->_github(owner => $owner, repo => $repo)->repos->fork; -} - -sub run_command_clone { - my $self = shift; - die "usage: git hub clone [--fork] [owner] <repo>" - unless @_ == 1 || @_ == 2 || @_ == 3; - - my $fork; - if ($_[0] eq '--fork') { - shift @_; - $fork = 1; - } - - if (@_ == 1) { - my ($repo) = @_; - my $user = $self->user; - git "clone git\@github.com:$user/$repo.git"; - } - else { - my ($owner, $repo) = @_; - if ($fork) { - $self->run_command_fork($owner, $repo); - $self->run_command_clone($repo); - { - my $d = pushd($repo); - $self->run_command_add($owner, $repo); - } - } - else { - git "clone git://github.com/$owner/$repo.git"; - } - } -} - -sub run_command_list { - my $self = shift; - die "usage: git hub list [-v] [owner]" - unless @_ <= 2; - - my $verbose; - if (@_ > 0 && $_[0] eq '-v') { - $verbose = 1; - shift @_; - } - - my $owner = defined $_[0] ? $_[0] : $self->user; - - print for map { - $verbose - ? ("$_->{name}:\n" - . ($_->{description} ? " $_->{description}\n" : '') - . ($_->{homepage} ? " $_->{homepage}\n" : '')) - : "$_->{name}\n" - } @{ $self->_github(owner => $owner, repo => '')->repos->list }; -} - -sub run_command_pullreq { - my $self = shift; - my ($owner, $repo, $title, $branch, $body) = @_; - die "usage: git hub pullreq <owner> <repo> <title> [branch] [description]" - unless @_ == 3 || @_ == 4 || @_ == 5; - - # XXX: should default to the current branch - $branch ||= 'master'; - - $self->_github(owner => $owner, repo => $repo)->pull_request->pull_request( - title => $title, - body => $body, - head => $self->user . ':' . $branch - ); -} - -sub run_command_add { - my $self = shift; - die "usage: git hub add [owner] <repo>" - unless @_ == 1 || @_ == 2; - my ($owner, $repo) = (@_ > 1 ? @_ : (undef, $_[0])); - - my $remote; - if ($owner) { - $remote = $owner; - git "remote add $remote git://github.com/$owner/$repo.git"; - } - else { - $owner = $self->user; - $remote = (any { /\borigin\b/ } git "remote") ? 'github' : 'origin'; - git "remote add $remote git\@github.com:$owner/$repo.git"; - } - - git "fetch $remote"; -} - -sub run_command_pull { - my $self = shift; - die "usage: git hub pull <num>" - unless @_ == 1; - my ($num) = @_; - - my $remote = (any { /\bgithub\b/ } git "remote") ? 'github' : 'origin'; - git "fetch $remote refs/pull/$num/head:pull-$num"; -} - -sub _github { - my $self = shift; - my %opts = @_; - - my $user = $ENV{USER}; - my $token; - - if (open my $login_info, '<', "$ENV{HOME}/.github") { - $user = <$login_info>; - chomp $user; - $token = <$login_info>; - chomp $token; - } - - Net::GitHub::V2->new( - (defined $user - ? (owner => $user, login => $user) - : ()), - (defined $token - ? (token => $token) - : ()), - repo => 'something_not_real', - %opts, - ); -} - -package main; - -my $res = App::Git::Hub->new(@ARGV)->run; -if (ref($res) eq 'HASH' && exists $res->{error}) { - die $res->{error}[0], "\n"; -} diff --git a/bin/git/git-jump b/bin/git/git-jump deleted file mode 100755 index a33674e..0000000 --- a/bin/git/git-jump +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh - -usage() { - cat <<\EOF -usage: git jump <mode> [<args>] - -Jump to interesting elements in an editor. -The <mode> parameter is one of: - -diff: elements are diff hunks. Arguments are given to diff. - -merge: elements are merge conflicts. Arguments are ignored. - -grep: elements are grep hits. Arguments are given to grep. -EOF -} - -open_editor() { - editor=`git var GIT_EDITOR` - eval "$editor -q \$1" -} - -mode_diff() { - git diff --relative "$@" | - perl -ne ' - if (m{^\+\+\+ b/(.*)}) { $file = $1; next } - defined($file) or next; - if (m/^@@ .*\+(\d+)/) { $line = $1; next } - defined($line) or next; - if (/^ /) { $line++; next } - if (/^[-+]\s*(.*)/) { - print "$file:$line: $1\n"; - $line = undef; - } - ' -} - -mode_merge() { - git ls-files -u | - perl -pe 's/^.*?\t//' | - sort -u | - while IFS= read fn; do - grep -Hn '^<<<<<<<' "$fn" - done -} - -# Grep -n generates nice quickfix-looking lines by itself, -# but let's clean up extra whitespace, so they look better if the -# editor shows them to us in the status bar. -mode_grep() { - git grep -n "$@" | - perl -pe ' - s/[ \t]+/ /g; - s/^ *//; - ' -} - -if test $# -lt 1; then - usage >&2 - exit 1 -fi -mode=$1; shift - -trap 'rm -f "$tmp"' 0 1 2 3 15 -tmp=`mktemp -t git-jump.XXXXXX` || exit 1 -type "mode_$mode" >/dev/null 2>&1 || { usage >&2; exit 1; } -"mode_$mode" "$@" >"$tmp" -test -s "$tmp" || exit 0 -open_editor "$tmp" diff --git a/bin/ipod_movie b/bin/ipod_movie deleted file mode 100755 index 8f0cdb4..0000000 --- a/bin/ipod_movie +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -in_name=$1 -out_name=$( echo ${in_name} | sed 's/\(.*\)\..*/\1_ipod.mov/' ) -aspect=$2 - -echo "Writing out ${in_name} in iPod format to ${out_name}..." -echo - -ffmpeg -vcodec xvid -b 350 -bufsize 4096 -g 300 -acodec aac -ab 96 -ac 2 -i "${in_name}" -s 320x240 -aspect ${aspect} "${out_name}" - -if [[ $? -eq 0 ]]; then - echo - echo "done." -else - echo - echo "failed." -fi diff --git a/bin/keyboard-swarp b/bin/keyboard-swarp deleted file mode 100755 index bcb8d67..0000000 --- a/bin/keyboard-swarp +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; - -use List::Util 'max'; - -my $keyboard = do { - no warnings 'qw'; - [ - [ qw(1 2 3 4 5 6 7 8 9 0 - =) ], - [ qw(q w e r t y u i o p [ ]) ], - [ qw(a s d f g h j k l ; ') ], - [ qw(z x c v b n m , . /) ], - ] -}; - -if ($ARGV[0] eq '--debug') { - require Term::ReadKey; - my ($xres, $yres) = Term::ReadKey::GetTerminalSize(); - my %offset_map = _calculate_offset_map($keyboard, $xres, $yres); - print "\e[2J"; - for my $row (@$keyboard) { - for my $key (@$row) { - my $offset = $offset_map{$key}; - print "\e[$offset->[1];$offset->[0]H$key"; - } - } - getc; -} -else { - my $key = $ARGV[0]; - my ($xres, $yres) = `xrandr` =~ /Screen 0:.*current (\d+) x (\d+),/; - my %offset_map = _calculate_offset_map($keyboard, $xres, $yres); - my $offset = $offset_map{$key}; - - # make sure the new location gains focus - system("swarp", 0, 0); - system("swarp", $xres, $yres); - - system("swarp", $offset->[0], $offset->[1]); -} - -sub _calculate_offset_map { - my ($keyboard, $xres, $yres) = @_; - - my %map; - - my $width = max map { $_ + 2 * @{ $keyboard->[$_] } } 0..$#$keyboard; - my $xincr = $xres / $width; - - my $height = @$keyboard; - my $yincr = $yres / $height; - - my $ypos = 0.5 * $yincr; - for my $row (0..$#$keyboard) { - my $xpos = (0.5 + $row) * $xincr; - for my $key (@{ $keyboard->[$row] }) { - $map{$key} = [int($xpos + 0.5), int($ypos + 0.5)]; - $xpos += 2 * $xincr; - } - $ypos += $yincr; - } - - return %map; -} diff --git a/bin/playcd b/bin/playcd deleted file mode 100755 index 1c2bde1..0000000 --- a/bin/playcd +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -if [[ -z $1 ]]; then - cdda2wav -q -e -d0 -N -B dev=/dev/cdrom & -else - cdda2wav -q -e -d0 -N -t$1 dev=/dev/cdrom & -fi - -PID=$! - -# this program skips a lot -sudo renice -5 ${PID} - -wait ${PID} diff --git a/bin/procmem b/bin/procmem deleted file mode 100755 index 3a7ce76..0000000 --- a/bin/procmem +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -if [ "$1" = "--help" -o "$1" = "-h" ]; then - echo "Syntax: `basename $0` [pid]..." - echo "If no pids are specified, all processes are listed" - exit 1 -fi - -cd /proc 2> /dev/null || { echo "No /proc directory."; exit 1; } - - -get_cmdline() { - local cmd - cmd="`tr '\000' ' ' < $1/cmdline`" - test -z "$cmd" && cmd="[`tr -d '()' < $1/stat | cut -d' ' -f2`]" - echo "$cmd" -} - -get_rss() { - grep "^VmRSS:" $1/status | awk '{ print $2 }' -} - - -# Determine the width of the stdout tty (if it is a tty) for clipping -width=`stty -F $$/fd/1 size 2> /dev/null | awk '{ print $2 }'` - -clip_line() { - test -n "$width" && expr substr "$1" 1 "$width" || echo "$1" -} - - -test -z "$1" && set -- `echo [0-9]* | tr " " "\n" | sort -n` - -header=$(printf "%5s %6s %6s %6s %6s %6s %s\n" \ -PID VSZ DEVMAP LIBMAP ALLOC RSS CMDLINE) - -clip_line "$header" - -for pid; do - totalmap=0 - devmap=0 - libmap=0 - alloc=0 - - test -f $pid/maps || continue - - { while read -u 99 range _ _ _ _ lib; do - size=$(( -(0x${range/-/-0x}) )) - let totalmap+=size - case $lib in - /dev/*) - let devmap+=size - ;; - "") - let alloc+=size - ;; - *) - let libmap+=size - esac - done; } 99< $pid/maps # '99<' is a workaround for a stupid bash bug - - output=$(printf "%5d %6d %6d %6d %6d %6d %s\n" \ - $pid $((totalmap/1024)) $((devmap/1024)) $((libmap/1024)) \ - $((alloc/1024)) "`get_rss $pid`" "`get_cmdline $pid`") - - clip_line "$output" -done diff --git a/bin/colors b/bin/show_colors index 136ad98..136ad98 100755 --- a/bin/colors +++ b/bin/show_colors |