Archive for the ‘Uncategorized’ Category

Nested Sessions of ’screen’ and Some PS1 Tricks

Wednesday, December 2nd, 2009

Here’s my original ’slide’ shown at NYCBUG’s December 2009 meeting.

But, here’s my full tricked out ~/.screenrc values:


escape ^tt

shelltitle makarioi

# k black
# r red
# g green
# y orange
# b blue
# m magenta
# c cyan
# w light grey
# d default
#
# R coral
# K grey
# G bright green
# Y yellow
# B purple
# M pink
# C bright cyan
# W white

hardstatus on
hardstatus alwayslastline "%{Wb}%?%-Lw%?%{Cb}%n*%f %t%?(%u)%?%{Wb}%?%+Lw%= %{Wb}@ %H %{kb}| %{Cb}%Y%{kb}_%{Cb}%m%{kb}_%{Cb}%d%{kb}_%{Cb}%D %{kb}| %{Wb}%c"

To help make sense of the hardstatus colors the following %{Cb} is ‘bright cyan‘ on a ‘black‘ background.

Ok, ok: here’s the most important part of your ~/.screenrc file: the escape directive.

ALL of my root logins have the following “escape ^^” value: vv.

Sure, you can’t ^v to paste into a shell, if your shell and desktop allow that, but *meh*, who cares? I’ve replaced that with X11’s middle click and Putty’s right click.

So, what about the rest of my user logins? I don’t exclusively login as root and I also use the Dvorak keyboard layout. With that in mind, what has worked out for me is to use, as the, what I’ll call, ‘the main login‘; which is my main user on the main host I login into – and that I would establish the root-nested-screen session at and with. (Hope that makes sense.).

With that user, I use this directive: escape ^tt.

With other, non-root, users, I use escape ^^g.

*taking a breath*

Ok, if you’re an avid *Nix user, you might have noticed how my last directive kills one particular function in both vi and vim: ^g. But, I’ve learned to live without knowing which file I’m currently editing in vi/m. No biggie.

Now, BEHOLD here are my super-select (if not secret, even!) PS1 variables and color codings:

$ echo $PS1
\[\e[00;34m\]________________________________________________________________________________\n\[\e[01;34m\](\j) \[\e[01;33m\]\h \[\e[00;31m\]<\t> \[\e[01;34m\]\w \n$ \[\e[00m\]

What? What do you mean I haven’t really shown anything really new…. You’re right. Let me redeem myself:

DIVIDER=${BLUE}
JOBCOUNTER=${PURPLE}
HOSTCOLOR=${YELLOW}
TIMECOLOR=${RED}
PATHCOLOR=${PURPLE}
OUTPUTCOLOR=${NOCOLOR}
PS2COLOR=${RED}

# Standard 'root' PS1 variable:
export PS1="\[${DIVIDER}\]________________________________________________________________________________\n\[${JOBCOUNTER}\](\j) \[${HOSTCOLOR}\]\h \[${TIMECOLOR}\]<\t> \[${PATHCOLOR}\]\w \n\$ \[${OUTPUTCOLOR}\]"
export PS2="\[${PS2COLOR}\]-> \[${OUTPUTCOLOR}\]"

*blush* I’ve forgotten how specialized I’d tricked out my $PS1 variable…. at least there’s some indications of what I’m trying to accomplish.

But, what if you don’t want to build your command prompt as I do?

Here are the color code hook-ups. You can use them in your ~/.bashrc file if you wish:

# My PS color variables:
BLACK='\e[00;30m'
BLACKISH='\e[01;30m'
RED='\e[00;31m'
ORANGE='\e[01;31m'
GREEN='\e[00;32m'
LIGHTGREEN='\e[01;32m'
BROWN='\e[00;33m'
YELLOW='\e[01;33m'
BLUE='\e[00;34m'
PURPLE='\e[01;34m'
MAGENTA='\e[00;35m'
PINK='\e[01;35m'
DARKCYAN='\e[00;36m'
CYAN='\e[01;36m'
GREY='\e[00;37m'
WHITE='\e[01;37m'
B_BLACK='\e[00;40m'
B_BLACKER='\e[01;40m'
B_RED='\e[00;41m'
B_ORANGE='\e[01;41m'
B_GREEN='\e[00;42m'
B_LIGHTGREEN='\e[01;42m'
B_BROWN='\e[00;44m'
B_YELLOW='\e[01;44m'
B_BLUE='\e[00;44m'
B_PURPLE='\e[01;44m'
B_MAGENTA='\e[00;45m'
B_PINK='\e[01;45m'
B_DARKCYAN='\e[00;46m'
B_CYAN='\e[01;46m'
B_GREY='\e[00;47m'
B_WHITE='\e[01;47m'
NOCOLOR='\e[00m'

ROCK ON!Now you, too, can use variables to specify PS1 colors as you like.

Man, I hope you enjoyed this.

Later,
bt

P.S. Coming later: If you want to have certain sessions start up automatically with a new screen session, there are some directives you can set up in your ~/.screenrc.

I Miss Bottle Rockets

Thursday, October 22nd, 2009

I just saw a product that had ‘bottle rocket’ in it’s name. I immediately remembered the sulfurous smell of bottle rockets and the thrill they brought me as a boy… shooting them from my backyard; off into the black of night at the bottom of the slow hill heading north from Bartlesville, Oklahoma.

They made the bottles dirty; grey from the smoke… a reminder of the price of the thrill of the zip and the pop: up and above.

Finally, a company that knows how to put support matters into perspective.

Friday, September 4th, 2009

Finally, a company that knows how to put support matters into perspective.

Here are the support request severity options from Dreamhost web hosting:

Dreamhost Support Severities

Dreamhost Support Severities

Early (1st?) Rear Suspension Bike

Tuesday, January 27th, 2009

I remember being a kid, when my oldest step-brother, Mitch, was into motocross. His dad, my step-father, modified a bike for him by making the rear triangle suspended by a motorcycle shock.

Here’s the pic:

That’s just a scan – not as good looking as the b&w original nestled in the frame of another picture hanging on his wall. But, there it is.

Let me know what you think – especially if you have pics of pre-July 1974 suspension bikes.

(To get a better view of the image right-click on it and select ‘View Image’ – or the equivalent in your browser.)

Adding an GELI encrypted partition with ZFS under FreeBSD

Wednesday, January 21st, 2009

Here are the following commands necessary for adding a GELI encrypted partition with ZFS under FreeBSD 7.0:

For this example I used my /dev/ad1s1 partition after the modules for GELI and ZFS have been loaded or built into the kernel.


$ geli init -v -b -e aes -s 4096 -l 256 /dev/ad1s1

    Enter new passphrase:
    Reenter new passphrase:
    Calculating number of iterations…
    Done, using 47492 iterations.
    Metadata value stored on /dev/ad1s1.
    Done.

[$ echo 'hint.kbdmux.0.disabled="1"' > /boot/device.hints]

$ geli attach /dev/ad1s1

    Enter passphrase:

$ ls /dev/ad1s1*

    /dev/ad1s1 /dev/ad1s1.eli

$ zpool create -m /var/mybackups backups /dev/ad1s1.eli
$ zpool list

    NAME SIZE USED AVAIL CAP HEALTH ALTROOT
    backups 189G 24.3G 165G 12% ONLINE -

$ vim /etc/fstab

    backups /var/mybackups zfs rw,noauto 0 0

Thanks to Rink Springer for his helpful article:
Encrypting your laptop with ELI and ZFS

Along with the links that helped him:
http://www.wanda25.de/geli.html
http://wiki.freebsd.org/ZFSOnRoot

1st New Year’s Eve in NYC

Wednesday, December 31st, 2008

A couple of friends from Texas are flying in today. We are planning on watching the ball drop in Times Square.

But, I’m having my reservations:

  • It’s already cold.
  • It will be colder still.
  • Accuweather says there’ll be rain at Noon today.
  • …with snow later this evening.
  • Then, it will be “brutally” cold for the ball drop.
  • They’re expecting 1,000,000 people in that (relatively) small area.
  • Most of them will be drunk (I’m guesing).

The upside is that I’ll be with my wife and friends. Also, I should try it once and be done with it.

If I do this again I think I’ll require an invite to some where indoors and with a view.

1st post!

Tuesday, December 30th, 2008

1st post isn’t such an honor… when there’s no competition.