Skip to content

Instantly share code, notes, and snippets.

View nogweii's full-sized avatar
🍀

Nogweii nogweii

🍀
View GitHub Profile
@nogweii
nogweii / gist:114339
Created May 19, 2009 19:44
check-network -- Determine if the network is up; dunno if we can go anywhere
#!/bin/sh
# Check the status of the network connection.
# Thanks to grnmtn on Freenode for this script!
#
# *0* return value indicates the network connection is active. No guarantees on
# the quality of the connection, or if the Internet works. We just have a cable
# in our ass, and it's on.
#
# non-zero return values indicate there was an error somewhere in this script.
evaryont | metaphor wars: GO!
rson | i've said it before and i'll say it again, even CLEAN ruby code looks like
someone took perl and some shell language and mixed them up in a pot, then overcooked them.
evaryont | rson: and python doesn't look like the illegeimate baby of pascal and cobol?
cactus | i imagine ruby as.. perl that some young girl got ahold of, and put sparkles
and makeup on.
# put this in ~/.zshrc
# No alias needed! The `whence -p` does a path search.
function ruby() { [[ "$1" == "" ]] && irb || `whence -p ruby` $@ }
@nogweii
nogweii / sample_config.txt
Created September 5, 2009 21:07
Simple user agent switcher code for uzbl
# Open dmenu to select a user agent
bind ZU = spawn $XDG_DATA_HOME/uzbl/scripts/switch_useragent.sh
# Immediately switch to the user agent, bypassing dmenu.
bind ZI = spawn $XDG_DATA_HOME/uzbl/scripts/switch_useragent.sh "iPhone"
bind ZA = spawn $XDG_DATA_HOME/uzbl/scripts/switch_useragent.sh "Android (G1) Browser"
@nogweii
nogweii / Github_Pages_weird_error.txt
Created October 14, 2009 23:33
IRC log from #github on Freenode; I have a *really* weird error, as documented here.
evaryont Is it just me or is github.com/*/ resulting in GithubPages saying "Page does not exist!" gist.github.com works, but no subfolders work under github.com/
evaryont No matter what URL I try accessing under github.com/, it always results in a github pages non existent error
@defunkt evaryont: like what url, for example?
bringo i ain't not getting no 404s
evaryont defunkt: ah, sorry, github.com/blog/ or github.com/evaryont/
evaryont it's weird as hell, I realize, and my desktop works just fine >_<
bringo strange. those URLs produce perfectly fine results for me.
bringo i blame Echelon
context evaryont: try clearing your cache?
context make sure you are not using ie?
@nogweii
nogweii / irbrc_hax0r.rb
Created October 21, 2009 13:36 — forked from scrooloose/irbrc_hax0r.rb
Awesome l33t method listings. Requires http://github.com/oggy/looksee/tree/master
require 'rubygems'
require 'looksee'
module Kernel
alias_method :orig_methods, :methods
def methods(*args)
if caller.first =~ /\(irb\):\d+:in `irb_binding'/
Looksee.lookup_path(self, *args)
else
orig_methods
@nogweii
nogweii / wtf_install.txt
Created November 14, 2009 01:57
wtf ruby gems. I just want the twitter gem! And how come you can't install rack nor thin?!?
# s gem install twitter
Your Password:
Building native extensions. This could take a while...
Building native extensions. This could take a while...
ERROR: Error installing twitter:
rack requires thin (>= 0, development)
# s gem install thin
ERROR: Error installing thin:
thin requires rack (>= 1.0.0, runtime)
# s gem install rack
@nogweii
nogweii / twitter_oauth.rb
Created November 26, 2009 01:22
Attempt at a simple Twitter CLI OAuth sample
#!/usr/bin/ruby
require 'twitter'
require 'pp'
oauth = Twitter::OAuth.new('key', 'secret');
rtoken = oauth.request_token.token
rsecret = oauth.request_token.secret
puts "> redirecting you to twitter to authorize..."
# Subject: Re: Newbie to Sinatra looking for example
# From: Ryan Tomayko <[email protected]>
# To: [email protected]
# Content-Type: text/plain; charset=UTF-8
#
# > Alright, so I'm pretty new to both Sinatra and web applications, and I
# > was wondering if someone could write up a quick example use of
# > Sinatra. Basically I want to see how Sinatra handles <form>s in one
# > view, and then shows the input on a different view.
# >
@nogweii
nogweii / gist:281253
Created January 19, 2010 20:20
An attempt at a CLI ruby OAuth Twitter client. Or at least the skeleton version
#!/bin/ruby
require 'rubygems'
require 'twitter_oauth'
@@config = YAML.load_file("config.yml") rescue nil || {}
@client = TwitterOAuth::Client.new(
:token => @@config[:token],
:secret => @@config[:secret]
)
if @client.authorized?