November 7, 2009

Compiling Irssi for Mac OS X 10.6

Filed under:technology — ryan @ 12:04 am

When upgrading from 10.5 to 10.6, I noticed that my laboriously-compiled (okay, okay, I’m being dramatic, but it WAS a pain) irssi broke, due to some funkiness with Perl and 64-bit. Unfortunately, recompiling Irssi for 10.6 proved to be even more of a pain, and I know that I myself will have a hard time with it if I don’t write down exactly what I did here. I’m assuming this’ll be useful for other folks, too.

I’ll try to provide notes and reasoning for each step in the directions below. Keep in mind that you’ll need the developer tools installed (from the ‘Additional Installs’ folder on the Snow Leopard install disc), and that I am NOT using Fink or DarwinPorts (it would be much easier if I did, however I am not a fan of package managers and separate library paths, etc). I also assume that you’re familiar with basic terminal commands (cd, ls, etc) and navigating filesystem paths (mostly to downloaded/untarred folders in your ‘Downloads’ folder).

(more…)

March 14, 2008

logrotate/apache and web hosting

Filed under:organization,technology — ryan @ 5:52 pm

Logrotate is a simple program that can perform simple but much-needed features, such as keeping log files from growing to 5gb. Heh. Anyhow, usually, it’s a simple matter of pointing it to the files and letting it do it’s thing.

What if you are a hosting company and you like to allow each user/domain you host access to their own logfiles in their own log directory? Well, without rotation, it’s possible that their logs can grow to gargantuan proportions, for a variety of reasons.

Manually adding and deleting the four or five line entries for each domain could get cumbersome, if your users add/delete domains as often as ours do. This shell script I wrote yesterday helps. It’s got a static section for the ‘main’ apache logs (like most non-hosting apache server setups), and then it dynamically generates the rest given a listing of directories in the main ‘www’ directory. This is not foolproof, and picks up some directories that do not correspond to domains, but there’s also a flag that tells logrotate not to bitch if it encounters them.

#!/usr/bin/sh
#
# ask ryan how this works
# or blame him if it’s broken
#
# if this script is to be cron’d
# just comment out the 3 lines with # SILENT after them
# so the script doesn’t spit out crap

# various variables, only edit the one beginning with ‘file’
file=/www/test2.txt                         # edit this to match logrotate file
backup=/tmp/test2-bak                        
short=`basename $file`
wwwdir=`ls -Ap /www/ | grep "/"`

# backup old logrotate file, create new one
mv $file $backup
touch $file

echo "—– populating $short —–"  # SILENT

# add static header information
# this is constant between updates
echo "### Apache Access Log" >> $file
echo " " >> $file
echo "/www/logs/*log {" >> $file
echo "    missingok" >> $file
echo "    postrotate" >> $file
echo "        /usr/bin/killall -HUP httpd 2> /dev/null || true" >> $file
echo "    endscript" >> $file
echo "}" >> $file
echo " " >> $file
echo " " >> $file
echo "### WebSite Access Logs" >> $file

# now to read all the apparent directories in
# /www/ and treat them like domains, add them
# to the list!  note to ryan: further filter later
for domain in $wwwdir
do
    echo " " >> $file
    echo "/www/"$domain"logs/access_log {" >> $file
    echo "  missingok" >> $file
    echo "  postrotate" >> $file
    echo "      /usr/bin/killall -HUP httpd 2> /dev/null || true" >> $file
    echo "  endscript" >> $file
    echo "}" >> $file
    echo "  `basename $0`: Added ‘$domain‘ to log rotation!" # SILENT
done                                                             

rm -f $backup
echo "—– all done! —–"  # SILENT

Where I work, after we were satisfied that it was doing it’s job when we ran it manually, it was added to cron.weekly.

January 16, 2008

bands script (bash scripting tutorial of sorts)

Filed under:lifestyle,music,technology — ryan @ 4:30 pm

I like to keep little lists, lately. It keeps me organized, sort of. If anyone has heard of or used the GTD (getting things done) system, they know what I am talking about. Anyhow, I am sick of forgetting bands that I find online that I really like, and would like to keep a wish list of albums to buy, so they are fresh in my mind and I can refer to the list if I get any disposable income.

So I wrote this script:

#!/bin/bash

# you can change the textfile variable to anything you want
# this allows you to make various lists and have different scripts
# for each.  simple but useful.
# I use it to make a list of albums I wanna get.

textfile=/Users/ryan/Music/bands-to-find.txt        #edit this line!!
filename=`basename $textfile`

if [ ${#} -lt 1 ]                   # if you are not adding something,
then                                # assumes you want to see file contents
    echo " "
    echo "— Contents of $filename: —"
    echo " "                        # let’s make a nice header/footer and
    cat -n $textfile                # show the file with line numbers :)
    echo " "
    echo "— End of $filename —"
    echo " "
    echo "Usage (to add a line)"    # then tell the dummy how to use it              
    echo "$ `basename $0` ‘line of text to add’ (use quotes!)"
else
    echo "$1" >> $textfile          # the actual simple command        
    echo "`basename $0`: added ‘$1‘ to $filename!"          # be proud!
fi

 

Basically it allows you to add a line to a text file easily and quickly, and if you just call the program up without wanting to add anything, it organizes the list and shows it to you prettily. This doesn’t have to be used for an album wish list (yet)..I could see someone modifying it for any sort of list…upcoming birthdays, baby names (haha babies), to-do list, videogame wishlist, etc. This is a super simple, but well-commented script that might be a good tutorial for anyone who wonders what good a shellscript can do, or wants to learn.

December 23, 2007

ruby

Filed under:technology — ryan @ 3:16 am

Ruby is a great language. It’s object-oriented in all the right ways, and the syntax is so simple, it reads like pseudocode.

I’ve been creating my very own roguelike using ruby. It took me a few false starts, but I am now using ruby’s built-in curses bindings. Click here to see the window setup I have decided to stick with. The big blank spot in the upper left is where the actual gameplay map will show up. The bottom is for narration/log of encounters and whatnot. The upper right is for character status, hp/mp/poisoned/hungry, that sort of thing. The lower right is for inventory, and the contents of chests/bags/etc.

For those interested in how I got that stuff to appear, it was as easy as this:

def draw_windows
    @map_win = Window.new(16, 60, 0, 0)
    @map_win.refresh
    
    border_win = Window.new(12, 20, 0, 60)
    border_win.box(0,0)
    border_win << ‘Status’
    border_win.refresh
    @stat_win = Window.new(10, 18, 1, 1)
    @stat_win.refresh
    
    border_win = Window.new(12, 20, 12, 60)
    border_win.box(0,0)
    border_win << ‘Stuff’
    border_win.refresh
    @stuff_win = Window.new(10, 18, 13, 61)
    @stuff_win.refresh
    
    border_win = Window.new(8, 60, 16, 0)
    border_win.box(0,0)
    border_win << ‘Travel Log’
    border_win.refresh
    @log_win = Window.new(6, 58, 17, 1)
    @log_win.scrollok(true)
    @log_win.refresh
end

October 11, 2007

midines mod complete

Filed under:music,technology — ryan @ 9:10 am

I forget if I posted pictures detailing the adding of gold-plated stereo rca jacks to my NES. Either way, this is the type of stuff I can do now

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

September 24, 2007

midines + logic = win

Filed under:music,technology — ryan @ 4:10 am

Hi, here’s an early example of how things are going to be from now on, now that I’ve got my midines kickin’ with logic 8 (which rocks, by the way).

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

And here’s how I look playing along with the midines, which is also providing glitchy-ass visuals on the tv behind me.

p.s. I am using a new flash player deal for the mp3s, so if you read this site through a rss reader it may not work.

September 4, 2007

doublet headphone amp and octopart.com

Filed under:music,technology — ryan @ 9:27 am

One of the blogs I read regarding DIY and/or audio linked me up to this post from Sam at octopart.com. Basically it is a headphone amp for two people. Well, it’s actually two headphone amps sharing an input and power, on the same board. It’s based on the design that my earlier amp was, and I already had a bunch of parts left over. Sam even sent me one of the pcbs for free as part of a promotion for their awesome site. If anyone who reads this is into DIY electronics, they should bookmark that site NOW. It’s very useful for part finding and pricing, and creating a parts list for a project. It helps you to combine orders and get the cheapest prices from various sellers.

So anyhow, here are a few pics of the thing. Since I can’t seem to poke proper holes in an altoids tin, we’re going to have to just look at it naked for now:




pay no attention to the terrible soldering on the capacitors

Oscilloscope and ‘untitled’ by john and i

Filed under:music,technology — ryan @ 8:57 am

Long time no blog.

I’ll be posting a few blogs today with some media as to what I have been up to. This one is in regards to the oscilloscope I got for ten bucks. Ten bucks! Here I am using it as a glorified iTunes visualizer. Usually, a guy like me would look at this video and say, “what a waste!”. Just remember. Ten bucks.

I still need to get probes for it…to use it so far I have just shoved copper wires into the outlets and attached alligator clips to them. I know, I know what you are thinking. But…ten bucks.

January 24, 2007

This one only goes

Filed under:technology — ryan @ 2:46 am

one way. ONLY.

January 23, 2007

I get so uselessly productive

Filed under:lifestyle,technology — ryan @ 4:01 am

when I don’t have a proper job:


next page