so i accidentally wild carded a part of the url on a graph, this was the result:

click image to enlarge

sometimes you get funny results from a fuck up.


this is how i got spotify to work on my install of gentoo.


grab a copy of the deb from here. just make sure to grab one for your respective build (x86 or amd64). at the time of writing, spotify-client_0.9.1.55.gbdd3b79.203-1_amd64.deb was the version available.

now lets uncompress the file : ar x file.deb

which should give us something similar to :
% ar x spotify-client_0.9.1.55.gbdd3b79.203-1_amd64.deb
[~/Downloads/deb] % ls -al
total 81608
drwxr-xr-x 2 user user 4096 Jul 3 16:56 ./
drwx------ 9 user user 4096 Jul 3 16:43 ../
-rw-r--r-- 1 user user 1499 Jul 3 16:56 control.tar.gz
-rw-r--r-- 1 user user 41724908 Jul 3 16:56 data.tar.gz
-rw-r--r-- 1 user user 4 Jul 3 16:56 debian-binary
-rw-r--r-- 1 user user 41726600 Jul 3 16:40 spotify-client_0.9.1.55.gbdd3b79.203-1_amd64.deb
[~/Downloads/deb] %

all we care about is data.tar.gz. lets uncompress that.

that should give us something similar to :
[~/Downloads/deb] % tar -zxf data.tar.gz
[~/Downloads/deb] % ls -al
total 40812
drwxr-xr-x 4 user user 4096 Jul 3 17:01 ./
drwx------ 9 user user 4096 Jul 3 16:43 ../
-rw-r--r-- 1 user user 41724908 Jul 3 16:56 data.tar.gz
-rw-r--r-- 1 user user 4 Jul 3 16:56 debian-binary
drwxr-xr-x 3 user user 4096 Jun 12 17:57 opt/
drwxr-xr-x 4 user user 4096 Jun 12 17:57 usr/
[~/Downloads/deb] %

all we want from here is opt/. lets check it out:
[~/Downloads/deb] % cd opt/spotify/spotify-client
[~/Downloads/deb/opt/spotify/spotify-client] 4 % ls -al
total 83516
drwxr-xr-x 5 user user 4096 Jun 12 17:57 ./
drwxr-xr-x 3 user user 4096 Jun 12 17:57 ../
-rw-r--r-- 1 user user 3919 Jun 12 17:51 changelog
-rw-r--r-- 1 user user 660348 Jun 12 17:53 chrome.pak
drwxr-xr-x 2 user user 4096 Jun 12 17:57 Data/
-rw-r--r-- 1 user user 3247638 Jun 12 17:53 devtools_resources.pak
drwxr-xr-x 2 user user 4096 Jun 12 17:57 Icons/
-rw-r--r-- 1 user user 54841384 Jun 12 17:57 libcef.so
-rw-r--r-- 1 user user 218801 Jun 12 17:50 licenses.xhtml
-rwxr-xr-x 1 user user 927 Jun 12 17:50 linklibs.sh*
drwxr-xr-x 2 user user 4096 Jun 12 17:57 locales/
-rw-r--r-- 1 user user 1973 Jun 12 17:50 readme.fedora
-rwxr-xr-x 1 user user 980 Jun 12 17:50 register.sh*
-rwxr-xr-x 1 user user 26389488 Jun 12 17:57 spotify*
-rw-r--r-- 1 user user 254 Jun 12 17:50 spotify.desktop
-rwxr-xr-x 1 user user 883 Jun 12 17:50 unregister.sh*
[~/Downloads/deb/opt/spotify/spotify-client] %

now, we have to check for all the shared library dependencies using ldd

[~/Downloads/deb/opt/spotify/spotify-client] % ldd spotify
./spotify: /usr/lib64/libcrypto.so.0.9.8: no version information available (required by ./spotify)
./spotify: /usr/lib64/libssl.so.0.9.8: no version information available (required by ./spotify)
        linux-vdso.so.1 (0x00007fff578ed000)
        libswmhack.so.0.0 => /usr/lib64/libswmhack.so.0.0 (0x00007f5c461e6000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f5c45fc9000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f5c45dc1000)
        libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/libstdc++.so.6 (0x00007f5c45aba000)
        libglib-2.0.so.0 => /usr/lib64/libglib-2.0.so.0 (0x00007f5c45795000)
        libgthread-2.0.so.0 => /usr/lib64/libgthread-2.0.so.0 (0x00007f5c45593000)
        libQtGui.so.4 => /usr/lib64/qt4/libQtGui.so.4 (0x00007f5c44905000)

i wont paste all of the output here since it is a bit much, but you have to ensure that you have all your proper libraries linked. as you will notice on my snippet, i left the first two unresolved. spotify seems to work fine without /usr/lib64/libcrypto.so.0.9.8 & /usr/lib64/libssl.so.0.9.8

once all those are linked, just start it up by running ./spotify

it should look similar to this except for all your preferences and playlists:
click bar to enlarge


so i got bored a couple of days ago and decided to write a magic 8 ball script. i know, they have been done a million times before, but it was 10 minutes and i wanted to see how centered in the terminal i could get it.

you can get it here.

here are the goods:


[ -z $(which tput 2>/dev/null) ] && { printf "%s\n" "tput not found"; exit 1; }

GRN=$(tput setaf 2)
YLW=$(tput setaf 3)
RED=$(tput setaf 1)
CLR=$(tput sgr0)

"`printf "${GRN}●${CLR} It is certain"`"
"`printf "${GRN}●${CLR} It is decidedly so"`"
"`printf "${GRN}●${CLR} Without a doubt"`"
"`printf "${GRN}●${CLR} Yes definitely"`"
"`printf "${GRN}●${CLR} You may rely on it"`"
"`printf "${GRN}●${CLR} As I see it yes"`"
"`printf "${GRN}●${CLR} Most likely"`"
"`printf "${GRN}●${CLR} Outlook good"`"
"`printf "${GRN}●${CLR} Yes"`"
"`printf "${GRN}●${CLR} Signs point to yes"`"
"`printf "${YLW}●${CLR} Reply hazy try again"`"
"`printf "${YLW}●${CLR} Ask again later"`"
"`printf "${YLW}●${CLR} Better not tell you now"`"
"`printf "${YLW}●${CLR} Cannot predict now"`"
"`printf "${YLW}●${CLR} Concentrate and ask again"`"
"`printf "${RED}●${CLR} Dont count on it"`"
"`printf "${RED}●${CLR} My reply is no"`"
"`printf "${RED}●${CLR} My sources say no"`"
"`printf "${RED}●${CLR} Outlook not so good"`"
"`printf "${RED}●${CLR} Very doubtful"`"


printf $(tput clear)
tput cup $(($(tput lines)/2)) $((($(tput cols)/2)-($W_CNT/2)))
printf "${ANSWERS[$INDEX]}"
tput cup $(tput lines) 0

so a couple of weeks ago i decided to write a dreamhost dns updater even though ttl is 4 hours.

This script uses your dreamhost api key (assuming it has dns access), to either check, delete, list, or update your ip address for a given record in dreamhost. Makes dynamic dns possible with dreamhost except for the four hour time to live (ttl). If you need a faster dynamic dns service, try DynDNS.

Here it is.

Usage : dh-dyndns [option] <value> <action>
    -h | --help   | help        shows this message
    -d | --domain | domain      domain which will be used (ex.: foo.bar.baz)
    -k | --key    | key         dreamhost api key
    -o | --option | option      actions to perform. listed below

    check           this checks whether existing ip is same as new.
    delete          this will delete record.
    exist           this will show you the existing ip address in record.
    list            shows you existing record according to domain.
    new             this will show you the new ip.
    update          this performs update of ip address according to whatever is
                    grabbed by check in script.

Sample Usage:
  update record: dh-dyndns -k ################ -d foo.bar.baz -o update

  check record : dh-dyndns -k ################ -d foo.bar.baz -o check

  update record: dh-dyndns -k ################ -d foo.bar.baz -o update

  help         : dh-dyndns -h

so a couple of weeks ago i decided to write an rfc-reader that is usable from the command line.

Here it is.

you can search for a bcp, fyi, ien, std, and an rfc.

then when you select one to read, a formatted term will pop up with it open.

i know there are hundreds of these, but i wrote one up anyway.

Usage: rfc-editor <name (-n)|read (-r)|search (-s)> <####> <bcp|fyi|ien|std|rfc>

Usage examples:
  rfc-editor name 3334 rfc     # displays RFC #3334 name
    ex: 3334 Policy-Based Accounting. T. Zseby, S. Zander, C. Carle. October
             2002. (Format: TXT=103014 bytes) (Status: EXPERIMENTAL)

  rfc-editor search  rfc # Displays index of matches with RFC #'s
    ex: rfc-editor search transport rfc

        0905 ISO Transport Protocol specification ISO DP 8073. ISO. April
             1984. (Format: TXT=249214 bytes) (Obsoletes RFC0892) (Status:

        0939 Executive summary of the NRC report on transport protocols for
             Department of Defense data networks. National Research Council.
             February 1985. (Format: TXT=42345 bytes) (Status: UNKNOWN)

  rfc-editor read 38 fyi       # read fyi #38

so i added two different password generator functions into my .zshrc.

one for regular:

function genpasswd() { 
    if [ -z $1 ]; then 
        echo "need a character count"
        tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${1} | xargs

and one for strong:

function genpasswd_strong() { 
    if [ -z $1 ]; then 
        echo "need a character count"
        tr -dc 'a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?=' < /dev/urandom | head -c ${1} | xargs

using them:
% genpasswd 12
% genpasswd_strong 12

simple enough.

here is a link to my .zshrc.


nothing in this post of any relevant value other than to show genoo running both spotify and steam.

click image to enlarge

click image to enlarge

love me some gentoo….


mutt and pgp

this article will cover using mutt with pgp, it is a work in progress.

this is gentoo centric and assumes that you are most likely using a google apps enabled domain or gmail address.

at time of writing :

first things first, lets install some software:

for non-gentoo systems:
install mutt, gnupg, and pinentry.

for gentoo systems :

% USE="crypt gnutls imap nls sasl smime smtp ssl" sudo emerge mutt
% USE="bzip2 nls readline usb" sudo emerge gnupg
% sudo emerge pinentry

lets move onto the configuration.

lets first create a gpg key :
% gpg --gen-key
(follow all the steps here)

now lets list our keys, to make sure they are right :
% gpg --list-keys
we need to copy the key ID since we will need that later

if you have not done so, i recommend uploading your keys (public) the the pgp key servers:
% gpg --send-keys "KEY ID"

now lets start creating the muttrc accounts section.

i tend to keep my accounts info separate from the muttrc file,
so at the bottom of the muttrc file just add a line that reads source ~/muttrc-accounts
but make sure to point to the right location of that file.
here is a sample of my muttrc-accounts file.

now lets start editing “muttrc-accounts”
for our config email we will use “foo@bar.com“,
and foo@baz.com which we will assume are google apps enabled domain.
for our key ID we will use “0xABCD1234
for our password we will use “P4SSW0RD

lets add a mailboxes section :

mailboxes 'imaps://foo@bar.com@imap.gmail.com:993/INBOX'
or for multiple accounts:
mailboxes 'imaps://foo@bar.com@imap.gmail.com:993/INBOX' \

now lets add an fkey macro so we can access these accounts by pressing either F5 or F6 (change to whatever suits you):

macro generic,index,pager  "c imaps://foo@bar.com@imap.gmail.com:993/INBOX/\n"

or for multiple accounts:

macro generic,index,pager  "c imaps://foo@bar.com@imap.gmail.com:993/INBOX/\n"
macro generic,index,pager  "c imaps://foo@baz.com@imap.gmail.com:993/INBOX/\n"

now for the account password management:

## we need to add this line to set up our account hooks
account-hook . 'unset preconnect imap_user imap_authenticators'

#### passwords ####
# to create gpg file : gpg -r foo@bar.com -e 
set my_tmp=`gpg -q --no-verbose -o /tmp/.passwords.tmp -d ~/.mutt-cfg/.passwords.gpg`
set my_pass_bar=`cat /tmp/.passwords.tmp | grep bar | awk '{ print $2 }'`
set my_pass_baz=`cat /tmp/.passwords.tmp | grep baz | awk '{ print $2 }'`
set my_del=`rm -f /tmp/.passwords.tmp`
#### end passwords config ####

now let me explain this section
the format that i use for the .passwords.tmp file is:
bar P4SSW0RD

which will then get an initial encrypting using : gpg -r foo@bar.com -e
the password that you set up here will be entered when you enter mutt using “my_tmp”, then stored into
variables “my_pass_bar” & “my_pass_baz”.
then the file is deleted once the passwords are set into vars by line set my_del=`rm -f /tmp/.passwords.tmp`

make sense so far ?

now lets add the account hook for our account (which is somewhat explained here):

#### foo@bar.com ####
account-hook 'imaps://foo@bar.com@imap.gmail.com:993/' \
' set imap_user = "foo@bar.com" \
imap_pass = $my_pass_bar '

folder-hook 'imaps://foo@bar.com@imap.gmail.com:993/INBOX' \
' set imap_user = "foo@bar.com" \
imap_pass = $my_pass_bar \
smtp_url = "smtp://foo@bar.com@smtp.gmail.com:587/" \
smtp_pass = $my_pass_bar \
from = "foo@bar.com" \
realname = "foo" \
folder = "imaps://imap.gmail.com:993" \
spoolfile = "+INBOX" \
postponed="+[Gmail]/Drafts" \
mail_check=60 \
imap_keepalive=300 \
signature="" \
pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f" \
pgp_verify_command="gpg --no-verbose --batch --output - --verify %s %f" \
pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f" \
pgp_sign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f" \
pgp_clearsign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f" \
pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0xABCD1234 -- -r %r -- %f" \
pgp_encrypt_sign_command="pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0xABCD1234 -- -r %r -- %f" \
pgp_import_command="gpg --no-verbose --import -v %f" \
pgp_export_command="gpg --no-verbose --export --armor %r" \
pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r" \
pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r" \
pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r" \
pgp_autosign=yes \
pgp_sign_as=0xABCD1234 \
pgp_replyencrypt=yes \
pgp_timeout=1800 \
pgp_good_sign="^gpg: Good signature from" '
#### end foo@bar ####

for the snippet above, remember to replace all instances of “foo”, “foo@bar.com”, & “0xABCD1234”.

if you want to add a second account :

#### foo@baz ####
account-hook 'imaps://foo@baz.com@imap.gmail.com:993/' \
' set imap_user = "foo@baz.com" \
imap_pass = $my_pass_baz '

folder-hook 'imaps://foo@baz.com@imap.gmail.com:993/INBOX' \
' set imap_user = "foo@baz.com" \
imap_pass = $my_pass_baz \
smtp_url = "smtp://foo@baz.com@smtp.gmail.com:587/" \
smtp_pass = $my_pass_baz \
from = "foo@baz.com" \
realname = "foo" \
folder = "imaps://imap.gmail.com:993" \
spoolfile = "+INBOX" \
postponed="+[Gmail]/Drafts" \
mail_check=60 \
imap_keepalive=300 \
signature="" '
#### end foo@baz ####

after all this is sourced from the main muttrc file, lets give it a start up.

you should be greeted by a pin entry box (“Enter passphrase” from encrypting the passwords file), like so :
click image to enlarge

after pin entry, press “F5” to get your mail.

now lets try to send encrypted mail.

so compose an email to yourself (press “m”).

once done composing and before sending, you will see your “Mutt: Compose” window like so:
click image to enlarge

From here you can verify “sign as” and “Security”, but if you press “p”, you will get the options to:
“PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, (i)nline format, or (c)lear?”, like so:
click image to enlarge

so lets encrypt and sign, so press “b”.
now press “y” to send.
once you press “y” it will ask you for your PGP passphrase, enter that, then mail is sent.

here is a sample of my muttrc-accounts file.


sources : http://www.mutt.org/doc/PGP-Notes.txt


so i have forgotten over the years how to add color to text in my terminal. so i wrote this script to show me some color combinations.

here is what the output looks like:
click image to enlarge


so after some initial struggling with the wonderful fog and specific versions of it to get chef rackspace tools working properly, i hit another bit of weirdness:

% knife rackspace server create -f6 -I  -r 'role[base]' -E <env> -S  -N  -VV --rackspace-version v2
DEBUG: version v2
DEBUG: version v2
DEBUG: rackspace_api_key xxxxxxxxxxxxxxxxxxxx
DEBUG: rackspace_username
DEBUG: rackspace_api_username xxxxxxxxxxxxxxxxxxx
DEBUG: rackspace_auth_url 
DEBUG: rackspace_auth_url auth.api.rackspacecloud.com
DEBUG: rackspace_endpoint 
DEBUG: rackspace_endpoint https://dfw.servers.api.rackspacecloud.com/v2
Instance ID: xxxxxxxxxxxxxxxxxxxx
Name:  Flavor: 8GB  Standard InstanceImage: 
Metadata: []

Waiting server................................................................................................................................................................................................................................
        /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/core/wait_for.rb:10:in `wait_for': The specified wait_for timeout (600 seconds) was exceeded (Fog::Errors::TimeoutError)
        from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/core/model.rb:65:in `wait_for'
        from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-rackspace-0.6.2/lib/chef/knife/rackspace_server_create.rb:183:in `run'
        from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/knife.rb:460:in `run_with_pretty_exceptions'
        from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/knife.rb:173:in `run'
        from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/knife.rb:123:in `run'
        from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/bin/knife:25:in `'
        from /opt/chef/bin/knife:23:in `load'
        from /opt/chef/bin/knife:23:in `

hmmh. 600 second timeout. the rackspace api is slow creating a > 8gb v2 box.

here is a temp fix:

edit the fog core timeout.rb file to make up for this:
% vi /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/core/timeout.rb

and replace @timeout = 600 with a more sane number.

i used 1500 to be on the safe side :
@timeout = 1500

again, this is a temp fix. YMMV