- Tab completion
- Aliases
- Logging
- Timestamps
- Customizable output
It also supports minimal line editing. That is, you can use the arrow keys to cursor around within the input line and edit as you please.
Wed, 31 Dec 2003tic update.
tic is almost ready for the real world, I added a *ton* of features to it today/yesterday (eh, I'm still awake and it's 8am...)
- Tab completion It also supports minimal line editing. That is, you can use the arrow keys to cursor around within the input line and edit as you please.
Comments: 0 (view comments)
Mon, 29 Dec 2003xterm -e screen? Something better...
I got tired of losing my terminal sessions whenever I decided I needed to
restart X for some reason, or one of my assclown dorm-mates decides to
ctrl+alt+backspace my X session. So, instead of enabling
DontZap
in my XF86Config, I figured I would just use screen to compensate. This wasn't
enough, seeing as xterm -e screen would just start up a new screen
session completely ignoring the current detached ones and thus defeating the
purpose of using screen for convenience. Thus, I wrote a two line script to fix
this problem:
#!/bin/sh
SESSION=`screen -ls | grep '(Detached)$' | sed -ne '1p' | awk '{print $1}'`
[ -z "$SESSION" ] && screen || screen -x "$SESSION"
What this does is look for the first detached screen session listed by screen -ls and use it to attach to. If there are no
currently-detached screen sessions running it'll start up a new one and running
your default shell.
Ok, so how is this useful? Put the script above in a file called "attach" and throw it in ~/bin/ (make that directory if you have to). Make sure you xterm -e ~/bin/attach [other xterm opts here] And you're good to go :)
Comments: 0 (view comments)
Fri, 26 Dec 2003tik, tac... tic!
So I got bored and started working on an aim client written, you guessed it, in perl. It's console-based and will eventually be very similar to
tac, but better. Eventually once I
get some bugs and basic features nailed out I'm going to attempt to write both
Gtk2 and Curses::UI front-ends for it.
Right now it supports the most basic of features including logging in, messaging, receiving messages, get user info, and aliases. Aliases can be nested, that is you can do: /alias foo /msg psikronic /alias bar /foo Hello!and then call /bar and it will call /foo Hello! which will in-turn call /msg psikronic Hello!. Huzzah.
I also added a
Comments: 0 (view comments)
Thu, 25 Dec 2003Whew! More updates.
More mason madness happening. Debugged some things I found wrong with, well, everything. I also *finally* added commenting. Thread support was also added (yay recursion).
Feel free to, well, post comments!
Comments: 0 (view comments)
bourne (sh, ksh, bash, zsh, ...) file descriptor fun
Yeah, so having just figured this out now (I'm sure it's in a manpage somewhere) -
You can open file descriptors at will by doing: exec 3> file_output The 3 here is the number of the file descriptor, and can be any number really. What this lets you do now is write to that file descriptor: echo "Hello there" >&3 Now, if you look at the contents of file_output you'll see that it contains "Hello there" - neat?
To close a file descriptor do this: exec 3>&- again, where 3 is the number of the file descriptor you want to close.
Comments: 0 (view comments)
poor man's netcat.
This script requires ksh. It makes use of a feature of ksh (zsh supports this too, but differently) called a co-process. A co-process is started by using the
|& pipe at the end of a command. The file descriptor you use to write to is >&p. To read from it, you use <&p. Here's an example:
tr 'a-z' 'A-Z' |& echo "hello there" >&p exec 3>&p; exec 3>&- cat <&p The output is: HELLO THERE WTF?! You might be confused, I was when I first started playing with these. What happens is it runs tr 'a-z' 'A-Z' in the background as a
co-process. Then it echos "hello there" to the input of tr. To
signify that we are in fact done sending input, we have to close the input file
descriptor, this is done through 2 statements: exec 3>&p - this
opens file descriptor 3 and has it output to the co-process. The next
statement, exec 3>&-, tells ksh you want to close file
descriptor 3, which in turn closes the input to the co-process. The last line
should be fairly obvious: cat <&p - it sends the output of the
co-process through cat. Ok, so you want that script do ya? Look below. #!/bin/ksh [ $# -ne 2 ] && echo "Invalid parameters" && exit 1 telnet $1 $2 |& cat <&0 >&p sed -e '1,3d' <&p I won't get into much detail as to how things work here, should be pretty straight-forward. It takes 2 parameters, first being the host and second being the port. It reads from standard input and outputs to standard output.
Comments: 0 (view comments)
Wed, 24 Dec 2003Mason rocks me sideways...
After browsing through the online Mason
book (which is free!) I set to work on converting this site from PHP. Oh
man is it simple. Doing things in perl is often much simpler than a similar
solution in PHP, so this makes me happy.
Comments: 0 (view comments)
Tue, 23 Dec 2003PHP -> perl HTML::Mason
I'm going to have a go learning HTML::Mason and in the process of doing so will convert this entire site to mason. I'll be posting updates and neat things I learn here, stay tuned...
Comments: 0 (view comments)
perl's CGI module
I have overlooked some of the coolest parts of perl's CGI module for the longest time - I've known it can generate HTML but I've always shrugged it off as thinking it can't do what i want it to, i couldn't have been more wrong.
What I'm specifically referring to is form generation. The rest of the HTML generating methods are useless to me (like the h1() method), but I'll focus on the cool form generating ones.
$poop = "email_address";
$default = "user@somedomain.com"
print 'Email address: <input type="text" name="' . $poop .
'" value="' . $default . '"><br>';
This prints out happy html that looks like this:
Email address:
Now, that print line is pretty damn ugly, but we can easily make it pretty once more by doing: use CGI qw/:standard/; print "Email Address: " . textfield($poop, $default) . "<br>"; And the output is:
Email Address:
Neat? Yeah.. What next? More neatness! You have an array you want to turn into a group of checkboxes...
use CGI qw/:standard/;
@foo = ("check1", "foo", "bar", "baz", "poopie", "hello", "Coke!", "Pepsi?");
@def = ("foo", "bar", "poopie");
print 'Checkbox listing:<br>';
print checkbox_group(-name => "options", -values => \@foo,
-columns => 3, -defaults => \@def);
print '<br>';
What does this look like?
Checkbox listing:
Comments: 0 (view comments)
Sun, 14 Dec 2003redbull+perl=hottness
The 2nd annual Redbull Coding Competition was held here at RIT, and oh was it awesome. 12 straight hours of teams of 3-5 people coding in various languages trying to attain one of the given objectives and while consuming insane amounts of redbull.
My team went to work with perl and we pushed out a half-decent graphical filebrowser and our remote team-member, pete, finished up the compression objective in record time. The whole competition was a hell of a lot of fun. <3 perl.
Comments: 0 (view comments)
|
Search this siteNavigationMetadataHome About Resume My Code (SVN)ArticlesARP Security Dynamic DNS with DHCP OpenLDAP+Kerberos+SASL PPP over SSH SSH Security: /bin/false Week of Unix Tools Work EfficiencyProjectsfex firefox tabsearch firefox urledit grok keynav liboverride newpsm (FreeBSD) nis2ldap pam_captcha poor man's backup Solaris audio utility xboxproxy xdotool xmlpresenter xpathtool misc scriptsPresentationsYahoo! Hack Day '08 Yahoo! Hack Day '06 Unix Essentials Vi/Vim Essentials SSH Tunneling (Video)Tag CloudCalendar
FriendsBarCamp Kent Brewster Tantek Çelik John Resig Wesley Shields Tyler ShieldsTechnorati |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||