View testmessagebox.rb
require 'logger' | |
require 'rbcurse' | |
require 'rbcurse/core/widgets/rmessagebox' | |
if $0 == __FILE__ | |
# Initialize curses | |
# some helper methods for working with stdlib FILE pointers | |
module CLib | |
extend FFI::Library | |
ffi_lib FFI::Library::LIBC |
View flac2m4a.zsh
#!/usr/bin/env zsh | |
for file ( *.flac ) { | |
print $file | |
newf=${file/flac/m4a} | |
ffmpeg -i $file $newf | |
} |
View lastpara.rb
#!/usr/bin/env ruby -w | |
=begin | |
* Name : lastpara.rb | |
* Description : splits a file into paras based on a blank line and prints last one | |
* Author : rkumar | |
* Date : 2012-12-08 - 12:54 | |
* Last update : 2012-12-08 17:00 | |
* License : | |
Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt) |
View listquery
#!/usr/bin/env zsh | |
# ----------------------------------------------------------------------------- # | |
# File: listquery | |
# Description: list files with query on size and age | |
# Author: rkumar http://github.com/rkumar/rbcurse/ | |
# Date: 2012-12-05 - 19:38 | |
# License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt) | |
# Last update: 2012-12-06 00:52 | |
# ----------------------------------------------------------------------------- # | |
# listquery Copyright (C) 2012 rahul kumar |
View z.sh
#!/bin/bash | |
# maintains a jump-list of the directories you actually use | |
# | |
# INSTALL: | |
# * put something like this in your .bashrc: | |
# . /path/to/z.sh | |
# In .zshrc, add the following. | |
#source ~/bin/z.sh | |
#function precwd () ; |
View brewdeptotals.sh
cd /usr/local/Library/Formula | |
# take out depends, removed everything other than dep, use awk to subtotal, sort on dep count | |
grep -h depends_on *.rb | sed 's/depends_on//g;s/=>//g' | tr -d "':\"" | awk '{ print $1}' | sort | subtotal.sh | sort -k 2 -n -t : |
View subtotal.sh
#!/bin/bash | |
# compute and print total occurrences for words in list | |
# e.g. dependincies or uses in brew | |
awk '{a[$1] ++} END{for (i in a) printf " %s: %2d \n",i, a[i]}' |
View list
#!/usr/bin/env zsh | |
# ----------------------------------------------------------------------------- # | |
# File: list | |
# Description: wrapper over 'ls' so I don't have to remember zsh's great expansions | |
# Author: rkumar http://github.com/rkumar/rbcurse/ | |
# Date: 2012-12-02 - 17:07 | |
# Last update: 2012-12-02 - 17:08 | |
# License: Free | |
# If you want to use 'v', get from https://gist.github.com/4188977 | |
# ----------------------------------------------------------------------------- # |
View v
#!/bin/bash | |
# | |
# Dec 22, 2011 | |
# Display recent files from viminfo and prompt for editing | |
[ "$vim" ] || vim=vim | |
[ $viminfo ] || viminfo=~/.viminfo | |
usage="$(basename $0) [-a] [-l] [-[0-9]] [--debug] [--help] [regexes]" |
View timestamp.vim
" Add this to your vimrc file | |
" auto-update "Last update: " if present whenever saving file | |
autocmd! BufWritePre * :call s:timestamp() | |
" to update timestamp when saving if its in the first 5 lines of a file | |
function! s:timestamp() | |
let pat = '\(Last update\s*:\s*\).*' | |
let rep = '\1' . strftime("%Y-%m-%d %H:%M") | |
call s:subst(1, 5, pat, rep) | |
endfunction |
NewerOlder