Skip to content

Instantly share code, notes, and snippets.

View relrod's full-sized avatar

Rick Elrod relrod

View GitHub Profile
#!/usr/bin/perl
sub _osascript
{
my $script = shift;
require IPC::Open2;
my( $read, $write );
my $pid = IPC::Open2::open2( $read, $write, 'osascript' );
#!/usr/bin/perl
sub _osascript
{
my $script = shift;
require IPC::Open2;
my( $read, $write );
my $pid = IPC::Open2::open2( $read, $write, 'osascript' );
#!/usr/bin/perl
sub _osascript
{
my $script = shift;
require IPC::Open2;
my( $read, $write );
my $pid = IPC::Open2::open2( $read, $write, 'osascript' );
#/usr/bin/ruby
require "socket"
# Here we require things for use later on...
require "net/http" # For parsing things...
require "rexml/document" # For XML parsing.
nick = "CB|RubyBot"
server = "irc.freenode.net"
port = 6667
#/usr/bin/ruby
require "socket"
# Here we require things for use later on...
require "net/http" # For parsing things...
require "rexml/document" # For XML parsing.
nick = "CB|RubyBot"
server = "irc.freenode.net"
port = 6667
require 'socket'
def c(nick)
@array = []
@nickvar = nick.to_s
@nickvar = TCPSocket.new("irc.dav7.net",6667)
@nickvar.send("USER CB#{nick} CB#{nick} CB#{nick} :CB#{nick}\n",0)
@nickvar.send("NICK CB#{nick}\n",0)
#puts nickvar.recv(1024)
@array.push(@nickvar)
class AnnouncementsController < ApplicationController
helper_method :redirect_to
before_filter :require_user, :except => "new"
# GET /announcements
# GET /announcements.xml
def index
@announcements = Announcement.find(:all)
respond_to do |format|
format.html # index.html.erb
#!/usr/bin/ruby
batt_stats = %x[ioreg -n battery -w 0 | grep BatteryInfo]
stats_info = batt_stats.match(/"Capacity"=(.*),"Amperage"=(.*),"Cycle Count"=(.*),"Current"=(.*),"Voltage"=(.*),"Flags"=(.*),"AbsoluteMaxCapacity"=(.*)\}/i)
stats_info = stats_info.to_a
capacity = stats_info[1].to_i
amperage = stats_info[2].to_i
cycle_count = stats_info[3].to_i
current = stats_info[4].to_i
voltage = stats_info[5].to_i
flags = stats_info[6].to_i
<?php
$source = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=pcon2009");
// First, get each of them in an array. It's easy to do this using explode().
$list = explode("\n",$source); // Put each in an array
$l = array();
foreach($list as $line){ // Iterate through the $list array.
// This gets a little confusing...
// Every time we iterate through the $list array, we add
<?php
$source = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=pcon2009");
include "ranks.php"; // so we have $array.
// First, get each of them in an array. It's easy to do this using explode().
$list = explode("\n",$source); // Put each in an array
$l = array();
$i = 0;