Author Archive for Logan Koester

29
Aug

slashhardcore.rb is a station tuner for Digitally Imported radio

I updated this script! Forgot to bind the /hardcore command before. Grab it now!

I was surprised how easy it is to write an XChat plugin in Ruby, even though it would be cooler to see a the xchat-ruby bindings pimped out DSL style…oh well.

Download slashhardcore.rb

Windows users must modify @launcher to the path to their Winamp, Firefox, IE, or other shoutcast-compatible player.

# slashhardcore.rb - A faster way to tune in than the playlist bot.
# Should work on Windows if you set a valid browser/winamp location.
#
# Usage: Put in your $HOME/.xchat2 directory to autoload, and restart xchat,
# or type "/load /path/to/slashhardcore.rb"
#
# Commands: /pls <station, /stations (list stations), /hardcore
#
# Author: Logan Koester <logan@logankoester.com>
 
include XChatRuby
 
class SlashHardcore < XChatRubyPlugin
 
	attr_accessor :launcher
 
	def initialize( plugin )
		@launcher = "/usr/bin/firefox"
		hook_command( "pls", XCHAT_PRI_NORM,
			method ( :pls ),
			"Use /pls <station> to tune in. Use /stations to check list
			of stations at di.fm"
		)
		hook_command( "stations", XCHAT_PRI_NORM,
			method ( :stations_list ),
			"Fetches an updated list of DI.fm stations"
		)
		hook_command( "hardcore", XCHAT_PRI_NORM,
			method ( :hardcore ),
			"Tunes into the happyhardcore.com radio stream"
		)
		puts_fmt "Digitally Imported!"
	end
 
	# Alias for /pls hardcore
	def hardcore (words, words_eol, data)
		puts_fmt "Hardcore is good for you!"
		play "hardcore"
		return XCHAT_EAT_ALL
	end
 
	# Tunes you in using your browses's default application
	# for *.pls files
	def pls (words, words_eol, data)
		station = words[1]
		puts_fmt "Tuning into #{station} (using #{@launcher})"
		@plugin.command( "/msg #candyball test" )
		play station
		return XCHAT_EAT_ALL
	end
 
	def play (station)
		exec "#{@launcher} http://di.fm/mp3/#{station}.pls" if fork == nil
	end
 
	# Returns the playlist filenames of playlists at di.fm
	def stations_list (words, words_eol, data)
		require 'open-uri'
		uri = "http://www.di.fm/mobile/?type=mp3"
		index = URI.parse uri
		list = index.read.to_s.scan(/="\/mp3\/(.*)\.pls/).flatten
		puts_fmt list.join ", " # CSV string
		return XCHAT_EAT_ALL
	end
end
22
Aug

killevery is what happens when programmers don’t sleep

A simple Ruby script to kill all processes with a specific name.

Looking back on what I’ve done after a night’s rest with mixed horror and amusement, it seems this script is completely and totally useless, unless you’re looking for a half-hearted reimplementation of killall in Ruby. Why the hell did I write this?

Download the script to /usr/bin (or wherever) and chmod +x ./killevery

#!/usr/bin/ruby
def killevery(victim, options)
	processes = `ps -A | grep #{victim}`.scan(/(d+) .*/)
	if processes.length &gt; 0
		puts "Killing #{processes.length} processes named #{victim}"
		processes.each { |p|
			print `kill #{options} #{p}`
		}
	else
		puts "No processes are named #{victim}."
	end
end
if $*.length &lt; 1
	puts "Kill every process named &gt;name&lt;. Takes the same parameters as killall"
else
	killevery($*.pop, $*.join(' '))
end
21
Aug

Installing Miro on Fedora Core 7

The official rpm provided at http://www.getmiro.com/download/ is dependent on an outdated Firefox.  If you have problems, try this:

  1. Download my fixed Miro-0.9.8-1.fc7.i386.rpm
  2. Run sudo yum –nogpgcheck localinstall Miro-0.9.8-1.fc7.i386.rpm

Enjoy!

12
Aug

Hello again, world!

Maybe you’ve noticed that my blog, until now known as Skin Deep, hasn’t been updated in a while. Well, there are three reasons for this.

  1. Wordpress is a complete and total pain in the ass. In particular, my half-assed theme was always breaking. Okay, maybe that’s my fault :-(
  2. Tumblr was serving my needs quite well, except when I needed special formatting or one of my feeds didn’t parse correctly.
  3. I rarely have time for lengthy, proofread editorial-style blogging, and was completely paranoid about bothering my subscribers with posts that may not be of interest. For the most part, Twitter has helped me overcome that phobia. From here on out, it’s my blog, and you’ll eat what I decide to feed ya.

However, I’ve outgrown Tumblr after too many instances where I really needed something to look or work a bit differently than the default, and had no way to customize it beyond Yahoo Pipes -style solutions.

So, after much consideration, I’m giving Wordpress another go. It was my discovery of dean.j.robinson’s fantastic “Redoable” theme that finally pushed me over the edge. Let me know if you like it as much as I do; I think it’s pretty damn sexy.




RSS Latest tweet

  • logankoester: Locked out of my apartment... Woops

Flickr Randomness

www.flickr.com

Netflix Queue


EveningMama's BoyRainbow Brite and the Star StealerThe Brazilian JobThe Gene GenerationParty Monster