Skip to content

Instantly share code, notes, and snippets.

View bhenderson's full-sized avatar

Brian Henderson bhenderson

View GitHub Profile
# this is a partial of a script that does my setup-routing. I needed to modify it to accept parameters.
# performs round-robin like link assignment
# args processing
function echo_usage {
echo "Usage: `basename $0` [link]* (defaults to last run params if exists, or ppp101 ppp102)"
}
if [ "$1" == "-h" ]
echo_usage
#!/usr/bin/env ruby
#helpful page:
# http://www.ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/IO.html
#
# This program tests the ability of ruby to know what stdout is.
# Its useful in the case below when I don't want a newline at the end if I am
# piping to something
def print_things
class YMech < WWW::Mechanize
private_class_method :new
def YMech.create
#do some stuff, define a global variable
#
# so my question is, how do I pass a block that I can also then pass to `new`?
# example of how you normally pass a block to new
#a = WWW::Mechanize.new { |agent|
# agent.follow_meta_refresh = true
~/.profile
...
##########
# http://linuxtidbits.wordpress.com/2009/03/23/less-colors-for-man-pages/
# Less Colors for Man Pages
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
#export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold
#bold colors don't work well in OSX Terminal. These changes add red keywords, with blue 'option' words (not sure precise term)
export LESS_TERMCAP_md=$'\E[00;31;2;74m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
class Myclass
#do some stuff
end
exit # I want to load this file into irb, but not actually run the below code. but exit quits irb
foo = Myclass.new
foo.poop
#!/bin/bash
#already installed? start service and exit
if ! [ -f /usr/bin/srvadmin-services.sh ]
echo "srvadmin utils not installed. installing"
else
echo "srvadmin utils installed"
/usr/bin/srvadmin-services.sh start
#!/bin/bash
#already installed? start service and exit
if ! [ -f /usr/bin/srvadmin-services.sh ]
echo "srvadmin utils not installed. installing"
else
echo "srvadmin utils installed"
/usr/bin/srvadmin-services.sh start
@bhenderson
bhenderson / screenrc
Created May 12, 2011 14:37
my screenrc file
startup_message off
shell -$SHELL
term "screen-256color"
shelltitle '$ |bash'
# not sure why I have to do this!
# cat ~/.screen.d/shell => ${SHELL} --login
#shell /Users/bhenderson/.screen.d/shell
#caption always "%?%F%{gk}%:%{rk}%?%n(%t) : %{g}[%{b}%l%{g}]"
defscrollback 100000
bind j focus down
$ [[ $TERM =~ "screen" ]] && echo true
true
$ [[ -t 0 && "*screen*" = $TERM ]] && echo true
$
require "minitest/autorun"
require "post_stats"
class PostStats
class << self
attr_accessor :client
end
end
class Net::HTTP