pgrep in ruby

2 Aug 1:46pm (4 days ago) reply

because osx doesn’t have one.


[visnup@Octal ~]$ cat /usr/local/bin/pgrep 
#!/usr/bin/env ruby

list = `ps -Ao pid,command`.split "\n"
matches = list.select do |l|
  pid, command = l.split nil, 2
  command.downcase.include? ARGV.first.downcase and pid.to_i != Process.pid
end

puts matches

twitter vs. me

2 Aug 11:59am (5 days ago) reply

i still need to figure out how to consolidate twitter vs. a blog post.

summer movies i wanna see

2 Aug 11:58am (5 days ago) reply

i need to write these down or i’ll forget. there are so many:

textmate go to file in vim

21 Jul 11:11am (17 days ago) reply

found this in the vim forums and tweaked it to be even better. put it in your .vim/plugin directory. also, do you have supertab? use with either :Find name or ,f (which is a mapping to :Fi). then type in something like ‘person’. if you’re going to abbreviate, use spaces where you want a wildcard. like:

pe show => could match ‘*pe*ople/show
pe pl sh => also could match ‘*pe*o*pl*e/*sh*ow’

it’s case insensitive and takes path names into account. g’yeah!


" from http://www.vim.org/tips/tip.php?tip_id=1432
" originally written by Samuel Hughes
function! Find(name)
  let l:_name = substitute(a:name, '\s', '*', 'g')
  let l:list=system("find . -ipath '*".l:_name."*' -not -path '*/.*' | perl -ne 'print \"$.\\t$_\"'")
  let l:num=strlen(substitute(l:list, "[^\n]", "", "g"))
  if l:num < 1
    echo "'".a:name."' not found"
    return
  endif

  if l:num != 1
    echo l:list
    let l:input=input("Which ? (<enter>=nothing)\n")

    if strlen(l:input)==0
      return
    endif

    if strlen(substitute(l:input, "[0-9]", "", "g"))>0
      echo "Not a number"
      return
    endif

    if l:input<1 || l:input>l:num
      echo "Out of range"
      return
    endif

    let l:line=matchstr("\n".l:list, "\n".l:input."\t[^\n]*")
  else
    let l:line=l:list
  endif

  let l:line=substitute(l:line, "^[^\t]*\t./", "", "")
  execute ":e ".l:line
endfunction

command! -nargs=1 Find :call Find("<args>")
map ,f :Fi 

iphone 2.0 software fonts

12 Jul 12:19am (26 days ago) reply

random nice feature of the new 2.0 software is the international character support in the fonts. all of my thai songs now show up correctly w/o any jailbreaking along with weird left-to-right farsi.

arm wrestling huned

11 Jul 3:27pm (26 days ago) reply

3:26:13 PM huned: f'realz.  maybe i'll organize an arm-wrestle-off
3:26:16 PM visnu: oh true
3:26:20 PM visnu: or get people drinking
3:26:20 PM huned: i think i can beat everyone here
3:26:22 PM huned: maybe not brent
3:26:24 PM visnu: yeah
3:26:28 PM huned: and maybe not gerad
3:26:29 PM visnu: i was about to say brent already beat you handily
3:26:31 PM huned: but def natalie
3:26:40 PM visnu: ... uh, that's one other person there
3:26:56 PM huned: that's right, i can be the champion

i love this show

7 Jul 12:53pm (about 1 month ago) reply

fucking up ruby

1 Jul 11:27pm (about 1 month ago) reply

class Fixnum
  alias :plus :+
  def + other
    if self == 1
      plus(other).plus 1
    else
      plus(other)
    end
  end
end

puts 1 + 2
puts 2 + 2
puts (1 + 2) == (2 + 2)

yes, it outputs:


4
4
true

not using msn chat anymore

30 Jun 3:14pm (about 1 month ago) reply

just like hotmail, all i was getting from msn chat/messenger was spam and i barely talk to anyone via it anymore. so, goodbye msn. i hope you fix your spam problem.

looking forward to hurting myself

27 Jun 5:08pm (about 1 month ago) reply

mai just got me a belated birthday skateboard!!! i’m excited. i even get to put it together myself. fuck yeah.

Strawberry loading
entries items