Skip to content

Instantly share code, notes, and snippets.

r__k_u_m_a_r rkumar

Block or report user

Report or block rkumar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rkumar
rkumar / testmessagebox.rb
Created Feb 23, 2013
testmessagebox.rb with stdin
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
@rkumar
rkumar / flac2m4a.zsh
Created Jan 26, 2013
convert FLAC files to m4a so you can play in itunes
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)
@rkumar
rkumar / listquery
Created Dec 6, 2012
list files prompting user to query on mtime and size
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
@rkumar
rkumar / z.sh
Created Dec 2, 2012
directory jumper
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 () ;
@rkumar
rkumar / brewdeptotals.sh
Created Dec 2, 2012
see which brews are most depended upon
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 :
@rkumar
rkumar / subtotal.sh
Created Dec 2, 2012
compute and print total occurrences for words in list
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]}'
@rkumar
rkumar / list
Created Dec 2, 2012
wraps ls in zsh for some interesting listings (zsh)
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
# ----------------------------------------------------------------------------- #
@rkumar
rkumar / v
Created Dec 2, 2012
# Display recent files from viminfo and prompt for editing
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]"
@rkumar
rkumar / timestamp.vim
Created Nov 29, 2012
timestamp auto-updating in files
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
You can’t perform that action at this time.