Archive for the ‘Ubuntu’ Category

Vmail CLI Email Client

Thursday, August 9th, 2012

Advertisements

Vmail is one of, if not the most awesome email client I have ever used. If you are a fan of the vim text editor, you are going to love Vmail.
The documentation on the Vmail website explains everything you need to know about usage and installing, so I will not cover usage here. I will show how to install it in Ubuntu 10.04 and higher. The suggested installation method uses RVM which was a bit tricky for me until I figured out that it needed sudo to put programs in your executable path. To install, type the following:
sudo curl -L https://get.rvm.io | bash -s stable --ruby
After it downloads it will begin the process. Read the screen, then press q to continue. Enter the source command it gives you right before your prompt reappears, or just close and reopen your terminal. Next, type:
rvm install 1.9.3
This command may take a while.
gem install vmail
To update to the latest version, simply type:
gem install vmail
again. I am currently using Vmail as my primary email client, and I am sure, after trying it you will be too. One last thing, if you would like to set a script as your signature, you can do so by placing:
signature_script: /home/USER/path/to/script
in your ~/.vmailrc

Help Power my blog posts, keep my caffeine buzz going strong!

TinTin – Alter Aeon

Thursday, June 28th, 2012

Advertisements

I have spent several months working on a trigger pack for the CLI based MUD client tintin++ to play the MUD Alter Aeon. Although it is still a work in progress I believe it is ready for people to use. It comes with a detailed readme file, so I will not include instructions for use hear, but here is how to install.

Ubuntu installation>

To get everything set up in Ubuntu open terminal and type the following:
sudo apt-get install git-core tintin++ sox libsox-fmt-all

Mac Installation

To get everything set up on a Mac:
If you want, you can download, extract, and build the latest version of tintin++ from source. Get the source code from
the tintin++ downloads page The technical details for how to install from source are beyond the scope of this article. Tintin++, a slightly older version, is available in mac ports.
Install macports:
the macports installation page
Install xcode and its command line tools available free from the Mac app store. The command line tools can be found under the download button on the toolbar, it’s the last item in the components table.
Open terminal:
sudo port install coreutils git-core gsed sox tintinxx wget xz
To be able to use the alt key abilities provided in this trigger pack, open terminal preferences and on the keyboard tab check use option as meta. Finally, select the file menu and choose use as defaults.
If you are using the Voiceover screen reader, the following tips may make for a more pleasant experience. Make sure to have terminal open when adjusting these settings:

  • Press VO+F8 and in Utility Category select activities.
  • Click Add to add a new activity and give it a name like terminal.
  • Select verbosity checkbox, VO+right arrow to select verbosity button.
  • Set speech verbosity to medium.
  • select additional settings to include checkbox.
  • Select the navigation checkbox.
  • Click set navigation.
  • Set Initial Position of VoiceOver cursor to keyboard focused item.
  • Uncheck keyboard focus follows VoiceOver cursor.
  • Uncheck voiceOver cursor follows keyboard focus.
  • Uncheck insertion point follows VoiceOver cursor.
  • Uncheck VoiceOver cursor follows insertion point.
  • Set mouse pointer ignores voiceOver cursor.
  • Check allow cursor wrapping.
  • Check skip redundant labels.
  • Click close and close VoiceOver utility.

Downloading the pack

Now that everything has been set up you can get the pack with the command:
git clone https://github.com/stormdragon2976/tintin-alteraeon.git
The download will take a few minutes. I am currently in the midst of switching most things sound related over to the built in MSP sounds which will decrease download times eventually.
After the download finishes, change to the tintin-alteraeon directory:
cd tintin-alteraeon
Mac users will need to do the following:
cp modules/bash_utils.mac modules/bash_utils.tin
You should only need to do this once. Cygwin and Linux users do not need to do this step.
You must be inside the directory for everything to work. Once there you can set up your characters. To do so, type
./multicharacter-setup.sh
and follow the instructions.
After you have created all your characters they will be available under ~/charactername. So, if you character is named Finn, you get to the character by typing:
cd ~/finn/
After you have changed to your character’s directory connect by typing:
tt++ aa.tin
You will get the tintin++ credits and a suggestion for a MUD to play. To actually connect type:
login
This will connect you to the game and you will be presented with the login menu.

Keeping Up To Date

Do the following to check for updates:
cd ~/tintin-alteraeon/
git pull
This will download any changes to the code or inform you that the code is already up to date.

Other Notes

Be sure to read the readme file included with the trigger pack. Remember, the first time you login to the game using this pack to type the word:
load
and press enter. It sets your skills and spells as well as some other information into variables which are necessary for the pack to work correctly.

Windows Users

Windows users will need to install a package called Cygwin. The easiest way to accomplish this is with a small cygwin-installer program written by michael Taboada. Run the program and follow the instructions. If you would prefer to do it manually though, download the setup.exe available on the install page to your desktop (do not run). Cygwin allows Windows users to 00run Linux applications. In order to do this, you will need some Linux packages. You can access the cygwin GUI and install packages that way, but the best way to handle package installation is to pass the packages you want to the installer, because the GUI isn’t 100% accessible as far as I know. There are several packages you will need. The easiest way I have found to do it is to right click the setup.exe file on your desktop, create shortcut. This is where things get a little confusing, because now you may have 2 setup.exe files on your desktop. usually the setup file will have something like "shortcut to" somewhere in the name, but not always. In my trials though focus is always given to the shortcut after it is created. Right click the shortcut and select properties. There are a couple of edit boxes here. the one we are interested in contains the path of the setup.exe executable "C:\…\setup.exe"
Here, after the closing quote, is where you need to paste the following flags and package names:
-A -q -P bc -P cron -P curl -P cygrunsrv -P gcc-core -P gcc-g++ -P gcc-ming2-g++ -P git -P glib -P glib2 -P inetutils -P make -P nano -P pcre-devel -P screen -P sox -P util-linux -P wget -P zlib
Select ok, then to run setup.exe with all the flags, just press enter on the setup.exe shortcut and allow it to run. You may need to select a mirror from the list when it runs. The first option in the list is ok.
If for some reason the shortcut keeps reporting problems, copy everything you have in the target box including the path inside the quotes, click run from the start menu, and paste into the box that comes up and 000press enter.
You will need to add a server, the list is accessible, you can just select the first one in the list, click add, then pretty much click next until installation starts. After a few minutes everything should complete successfully and you should get a finish button. After that, Cygwin is installed.
Next, download the tintin++ source code .tar.gz file from Sourceforge and Save it to your desktop and do not extract it. If you are using Windows Internet Explorer, you may get a sound notifying you that the download has been blocked. To focus the information bar press alt+n then press space to activate it and allow the download.
Now, it’s time to open cygwin. To do so, under the start menu, click run. when the box opens for a command type:
cmd
and press enter. To launch cygwin itself type the following at the prompt:
c:\cygwin\Cygwin.bat
Note the C in Cygwin.bat is capitalized. All the other letters in the command are lower case.
If you would like to paste into the command line, you will notice that control+v is not enabled for pasting. You will need to press alt+space, arrow down the to "Edit" menu, and select paste from it.
When you press enter, you will be in the Cygwin terminal. The first time you run it it creates a few things like your .bashrc.
Now, it is time to extract and compile your downloaded tintin file. To do this you need to first extract it from the desktop. Here is where I must tell you about bash’s tab autocompletion feature. If you know the first part of something, but not the whole thing, you can type the first few letters then hit tab and bash will complete it for you. You will probably want to make heavy use of this in the next command because it will likely be different for each user. Adjust the path to the file acording to your version of Windows and user information:
tar xzvf /cygdrive/c/Documents\ and\ Settings/USER/Desktop/tintin…tar.gz
USER is your windows logon name. You can do /cygd <tab> c/Doc <tab> Desk <tab> tintin <tab> and each time you press the tab key the path will be completed until you have the whole path to the file. Press enter and the file will be extracted into your home directory and things will get a lot easier from now on.
After the extraction has completed, a matter of a couple seconds, do the following to compile tintin++:
cd tt/src/
./configure
make
make install
After that finishes type:
cd
to get back to your home directory.
Now, all that is left is to clone the git repository for tintin-alteraeon. The git repository houses all the code for the tintin++ trigger pack. You pull the code from it, and all the updates as well. Because cygwin doesn’t automatically install certificates for you, you will have to prepend each git command with:
env GIT_SSL_NO_VERIFY=true
For example, to do the initial clone of the git repository, you would type:
env GIT_SSL_NO_VERIFY=true git clone https://github.com/stormdragon2976/tintin-alteraeon.git
Note, I have been unable to get multicharacter-setup.sh to work in cygwin. You will have to creat links manually if you have multiple characters.
To read the README file in the tintin-alteraeon directory, you can open it in the Nano text editor:
nano README
When you are done with the file, press control+x to close it.
Incidentally, if you would like to install my talking-clock package in cygwin there is only a couple more steps required. You already have the packages you need installed from the list above. The only thing you have to do is install cron as a service. To do so, enter:
cygrunsrv –install cron –path /usr/sbin/cron –args -n
cygrunsrv –start cron
If you run into problems with cron in Windows this article may be of help.
Next, you need to write a short bash script so that espeak will work. You can use any synth that will take commande line input, but for this example we shall use espeak. Make sure you have the windows version of espeak installed from:
http://espeak.sourceforge.net/. Then, inside the cygwin terminal, type:
nano /usr/bin/espeak
The nano text editor will open, and you can paste the following 3 lines into it:
#!/bin/bash
“/cygdrive/c/Program Files/eSpeak/command_line/espeak.exe” “$@”
exit 0
Press control+x to save the file. It will ask if you want to save changes, press y, then it will ask for the file name, just press enter because you already gave the name when you opened the file. The path in the file may be different for you depending on your Windows version and configuration.
The final thing you have to do is make your espeak script executable. So, type the following:
chmod 755 /usr/bin/espeak
Now, you can test it out by typing:
espeak "hello world"
To set up talking-clock:
env GIT_SSL_NO_VERIFY=true git clone https://github.com/stormdragon2976/talking-clock.git
cd talking-clock/
chmod 755 INSTALL
./INSTALL
To test it you can type:
talking-clock
Talking-clock has lots of capabilities, including using soundpacks for chimes. It uses cron to schedule chimes and can chime 1, 2, or 4 times per hour. To make it chime two times an hour, for example, you would type:
talking-clock –cron 2
All the information you need for configuring talking-clock can be found in the file called README in the same directory as the INSTALL file.
Top open the README in the nano text editor:
nano README
To close it again control+x. If you accidently made changes just press n if it asks you if you want to save. And Nano will close without making any changes to the file.
Have fun and if you have questions leave them in the comments.

Help Power my blog posts, keep my caffeine buzz going strong!

Easily Share Files and Directories with Dropbox’s Public Directory

Friday, October 28th, 2011

Advertisements

After reading this Lifehacker Article, I was convinced that similar functionality is possible in Linux. turns out I was right. Here’s a script you can add to .gnome2/nautilus-scripts to add the same functionality without having a program constantly running in your system tray like is required for Windows users. further more, my script will zip a directory before copying it to Dropbox, so no need to right click each file individually if you want to share a whole directory. If you’re not sure how to get it set up, here are instructions:
open Accessories, Terminal
cd ~/.gnome2/nautilus-scripts/
wget http://stormdragon.us/scripts/share-with-dropbox.sh
chmod 700 share-with-dropbox.sh
Now, you can right click any file or directory, select scripts, and click on share-with-dropbox to copy the file to your public directory and have the link automatically placed in your clipboard. This script requires that xclip be installed. From terminal:
sudo apt-get install xclip
enjoy, and I hope you find this useful.

Help Power my blog posts, keep my caffeine buzz going strong!

Sharing the Clipboard with the Console

Wednesday, May 18th, 2011

Advertisements

Sharing the clipboard between your GUI desktop and the console can be a bit of a challenge. I was doing it by pasting into a temperary file then opening that file in the console. Then, however, I got to thinking there has to be a better way. So, I wrote a bit of code in python to automatically check the clipboard for text and write it to /tmp/clipboard. It works quite nicely, but I have noticed that when it is running, switching between applications with alt+tab is slower than normal. It may be something to do with the loop slowing things down, but I am not sure. For those who are interested, here is the code:
#!/usr/bin/python
#Clipboard to File Written by Storm Dragon
#Copyright May 2011 by Storm Dragon
#License GPL
#This program places any text in the clipboard into the file /tmp/clipboard
#The file is updated every 0.5 seconds

#Library import section
import time
import pygtk
import gtk
#Loop forever!
while True:
    #Get the clipboard
    cb = gtk.clipboard_get()
    #assign the clipboard contents to a variable.
    cbText = cb.wait_for_text()
    if isinstance(cbText, str) == True:
        file = open(“/tmp/clipboard”,”w”)
        file.write(cbText)
    time.sleep(0.5)
After I completed this small program I learned of the existance of a clipboard manager called parcellite. In Ubuntu and Vinux you can install it with:
sudo apt-get install parcellite
You can adjust parcellite’s preferences by right clicking on it in the panel and selecting preferences. If you left click it you will get the clipboard’s contents and the history up to 100 previous selections depending on the setting in preferences. You can also access the clipboard history with the keyboard shortcut control+alt+h. In order to have parcellite start when you login, you will need to add it to startup applications in System, Preferences, Startup Applications. If you choose to use my script you can add it to startup applications instead.
If you use parcellite you can access the clipboard history in the console in the file located at:
~/.local/share/parcellite/history
Because it is a binary file it does not work in Gedit.
If you use my program or the clipboard manager glipper it will work in gedit. The file my program writes to is:
/tmp/clipboard
My program does not contain any history, only the last text in the clipboard.
After a bit more research I find I prefer using the clipboard manager Glipper:
sudo apt-get install glipper
To access the clipboard press control+alt+c. To access the history in the consolesimply open the file:
~/.glipper/history
Of course, if you use glipper you do not need my script.
Parcellite also has the ability to copy text from the terminal, gnome-terminal or any terminal opened from the desktop. If you try from the console you get an error about not being able to open the display. If you do:
echo “hello world” | parcellite
then the words "hello world" will be in your clipboard. You can accomplish the same thing by using a program called xclip:
sudo apt-get install xclip
To place something in the clipboard:
echo “hello world” | xclip -selection clipboard
You can download Clipboard to File by right clicking the link and selecting save link as.
After some descussion it was decided that probably the best way to cut out the lag caused by clipboard-to-file is to drop the loop completely and just bind the program to a keyboard shortcut. So, here is the new code, the download link will now also get you this code as well:
#!/usr/bin/python
#Clipboard to File Written by Storm Dragon
#Copyright May 2011 by Storm Dragon
#License GPL
#This program places any text in the clipboard into the file /tmp/clipboard

#Library import section
import time
import pygtk
import gtk
#Get the clipboard
cb = gtk.clipboard_get()
#assign the clipboard contents to a variable.
cbText = cb.wait_for_text()
if isinstance(cbText, str) == True:
    file = open(“/tmp/clipboard”,”w”)
    file.write(cbText)
I went to System, Preferences, Keyboard Shortcuts and added clipboard-to-file and set its shortcut to control+alt+v. This new method has all of the coolness with none of the slowness.
One more thing that will make sharing info between the GUI desktop and the console easier is a paste command for the IRC client irssi. I actually have 2 of them. These use assume you are using glipper. The first simply pastes the last thing in your clipboard history to irssi and sends it as a message:
/alias paste /exec -o cat /home/USER/.glipper/history | head -n 2 | tail -n 1
the other is for when you want to paste several lines. Each line will be sent as a message so be careful with this one. Irssi will prompt you if you try to send more than seven lines, so there is a safety net:
/alias read /exec -o cat /tmp/clipboard
To use this one just make sure the text you wanto to send as a message is in the file /tmp/clipboard.

Help Power my blog posts, keep my caffeine buzz going strong!

Music Status for BitlBee

Thursday, March 17th, 2011

Advertisements

For nearly every instant messenger in Linux there is a plugin or the ability to set your status to the currently playing song. I was surprised to find that nothing like this was available for Irssi and BitlBee though. So, I decided to see if I could do anything about it. It turned out to be a lot harder than I thought it would be to get this working, but finally after a lot of tinkering and help from the #irssi channel on irc.freenode.net as well as the Irssi info email list, it’s alive!
First, let’s get everything set up. You will need the cron script for Irssi. Save the script to your ~/.irssi/scripts directory. You may need to create the scripts directory. Then create a simlink to cron.pl from the ~/.irssi/scripts/autorun/ directory. the autorun directory may also need to be created. to make the simlink:
ln -s ~/.irssi/scripts/cron.pl ~/.irssi/scripts/autorun/cron.pl
This causes the cron.pl script to start with Irssi. For this example I decided to use Pianobar, console based Pandora player. You can use a script file called eventcmd.sh located in ~/.config/pianobar/ to make Pianobar do some pretty nifty things. Part of what mine does is set status for Pidgin instant messenger and also write a file in /tmp/irssistatus that contains a small script to set by bitlbee status to the currently playing song. Here is my file which is based off the example file included with Pianobar:
#!/bin/bash
# create variables
while read L; do
k="`echo "$L" | cut -d '=' -f 1`"
v="`echo "$L" | cut -d '=' -f 2`"
export "$k=$v"
done < <(grep -e '^\(title\|artist\|album\|stationName\|pRet\|pRetStr\|wRet\|wRetStr\|songDuration\|songPlayed\|rating\|coverArt\|stationCount\|station[0-9]*\)=' /dev/stdin) # don’t overwrite $1…
album=$(echo "$album" | sed 's/ (Explicit)//g')
case "$1" in
"songstart")
/usr/bin/purple-remote "setstatus?status=available&message=Listening to $title by $artist from $album" &> /dev/null
irssiStatus="#!/bin/bash
echo \"set status 'Listening to $title by $artist from $album'\"
exit 0"
irssiStatus=$(echo "$irssiStatus" | sed 's/\&/and/g')
irssiStatus=$(echo "$irssiStatus" | sed "s/'/\\'/g")
echo "$irssiStatus" > /tmp/irssistatus
chmod 700 /tmp/irssistatus
;;

"songfinish")
if [ -n "$songDuration" ] && [ $(echo "scale=4; ($songPlayed/$songDuration*100)>50" | bc) -eq 1 ] && [ "$rating" -ne 2 ]; then
/usr/lib/lastfmsubmitd/lastfmsubmit --artist "$artist" --title "$title" --album "$album" --length "$((songDuration/1000))"
fi
;;
"songlove")
statusText="#nowplaying \"$title\" by \"$artist\" from \"$album\""
ttytter -readline=0 -silent -status="$statusText"
;;
*)
if [ "$pRet" -ne 1 ]; then
echo "naughty.notify({title = \"pianobar\", text = \"$1 failed: $pRetStr\"})" | awesome-client -
elif [ "$wRet" -ne 1 ]; then
echo "naughty.notify({title = \"pianobar\", text = \"$1 failed: Network error: $wRetStr\"})" | awesome-client -
fi
;;
esac
exit 0
#end eventcmd.sh
If you have createdd the file to ~/.config/pianobar/eventcmd.sh, set it to executable, and it doesn’t seem to work, edit the file ~/.config/pianobar/config and add the line:
event_command = /home/USER/.config/pianobar/eventcmd.sh
You can add your Pandora user name and password if you want:
user = Your Email Address
password = YourPassWord
This will allow you to automatically login without being prompted for your information each time.
The above script will also post the songs you love by pressing the + key to Twitter using TTYtter. It scrobbles to Last.fm using lastfmsubmitd:
sudo apt-get install lastfmsubmitd
Then edit the file:
/etc/lastfmsubmitd.conf
and add the following three lines:
[account]
password = yourLast.fmPassword
user = Last.fmUserName
Your user name is your account user name not your email address.
If you get permission denied errors for /var/spool/lastfmsubmit… files, the following code may correct the problem:
for i in /var/log /var/run /var/spool; do sudo chown lastfm:lastfm $i/lastfm; sudo chmod 775 $i/lastfm;done
And now, back to the original idea for this article. You have your shiny new eventcmd.sh file in place, you have your cron.pl script in the ~/.irssi/scripts directory and have it set to start when Irssi does. So, now, start irssi and type the following line:
/jobadd -server localhost * * * * * /exec -msg &bitlbee /tmp/irssistatus
To save it for future use type:
/jobssave
Then, the next time you start Irssi and login to BitlBee type:
/jobsload
to get it up and running again. And there you have it, your very own musical status for BitlBee. If you don’t have BitlBee installed but use a public installation, you will need to change the -server bit in the /jobadd line to your public server. There is one small problem though. In your &bitlbee control channel you will keep getting your message to set the status and then the root confirming it has been set. I have managed to get rid of the confirmation message but the actual set status from your nick will still show up. To block out the confirmation:
/ignore -regexp -pattern “(set status|status =)” *
There is probably a better way but regexps are not my strong point, so suggestions are welcome.
If you aren’t listening to anything and the /tmp/irssistatus file doesn’t exist you will get an error. the easiest way to correct this is to write the /tmp/irssi file by hand with your chosen status:
#!/bin/bash
echo 'set status "GREEN! like a booger!"'
exit 0
That one will definitely get you some ims Usually consisting of things like "What the hell!?". If you would like a bit more of a random status you can use this instead:
#!/bin/bash
status=$(fortune -s | sed "s/'/\\'/g")
status=$(echo "$status" | tr "[:space:]" " ")
if [ $(echo "$status" | wc -l) -eq "1" ] ; then
echo "set status '$status'"
fi
exit 0
The above script will give an error if the fortune is not in English. In the music script, some songs with odd things in their names may cause errors. this is rare as far as I can tell. I think I have fixed most if not all of them.

Help Power my blog posts, keep my caffeine buzz going strong!

Shell-fm, a Command Line Last.fm Player

Thursday, September 16th, 2010

Advertisements

I was searching for a good command line last.fm player to use on my netbook. Command line apps really have an advantage on netbooks because of their speed. The player I chose is shell-fm. It is easy to configure and use, and has a nifty ability that makes it, in my opinion, easily the best choice. You can run other command line commands from inside shell-fm and, better still, bind the command to a keypress. I will show you why this is so awesome in just a sec, but first, installation.
Although you can install shell-fm from the repositories with:
sudo apt-get install shell-fm
you will probably want to compile it from source. The latest version has built in volume controls using the + and – keys. To compile from source open terminal and type:
sudo apt-get install git-core
sudo apt-get build-dep shell-fm
git clone http://github.com/jkramer/shell-fm.git
cd shell-fm/
make
sudo make install PREFIX=/usr MANDIR=/usr/share/man
When it is finished installing switch back to your home directory by typing:
cd
Create the .shell-fm/ directory by typing:
mkdir .shell-fm/
mkdir .shell-fm/cache/
then create the shell-fm configuration file:
gedit ~/.shell-fm/shell-fm.rc
There are several things you can put in this file. I only have three or four lines in mine though. The format is:
variable = setting
Here is a sample of what you can put in it. Replace USER with your Last.fm user name and PASSWORD with your Last.fm account password. Note that only upper case words should be changed:
username = USER
password = PASSWORD
title-format = Now playing %t by %a from %l
screen-format = Now playing %t by %a from %l
term-format = Now playing %t by %a from %l
default-radio = lastfm://user/USER
The last line loads your chosen radio station when shell-fm opens. If you use the default-radio line above with your user name the station that plays is your last.fm library. If you would like to automatically download free songs, add the next line replacing USER with your home directory:
download = /home/USER/Downloads/%a – %t.mp3
Downloaded tracks will be saved in your ~/Downloads directory.
And now, as promised, I will show you some extra coolness. If you have installed TTYtter, Here is a script that uses TTYtter to tweet the currently playing song. To get it set up open terminal and type the following line:
wget --output-document ~/.shell-fm/tweet.sh http://www.stormdragon.us/scripts/tweet.sh
chmod 700 ~/.shell-fm/tweet.sh
Finally, the key binding thing I mentioned earlier. In your ~/.shell-fm/shell-fm.rc add the following line. Replace USER with the name of your home directory (usually your login name):
key0x74 = /home/USER/.shell-fm/tweet.sh %t %a %l %T
This binds the tweet script to the lower case letter t. the key format uses the HEX value of the ASCII character. You can get the HEX value using a Hex to ASCII Converter. The key must be entered as:
key0xHEXNUMBER = command
Shell-fm also has the ability to run a command when a song starts or when it ends. One use for this is to set your status in Pidgin to the currently playing track. To do this, open your ~/.shell-fm/shell-fm.rc and add the line:
np-cmd = /usr/bin/purple-remote ‘setstatus?status=available&message=Listening to %t by %a from %l’
If you do it this way though your status may have a lot of \ characters in it. To avoid this, put it in a script and call it like the tweet script above without the URL. Here is status script. Save it in your ~/.shell-fm/ directory and call it like this:
np-cmd = /home/USER/.shell-fm/status.sh %t %a %l
Don’t forget to change permission to 700 with:
chmod 700 ~/.shell-fm/status.sh
To get instructions on using shell-fm type:
man shell-fm
or if you are running shell-fm type:
?
for a list of commands.

Help Power my blog posts, keep my caffeine buzz going strong!

Extending TTYtter

Sunday, September 12th, 2010

Advertisements

The TTYtter extension pack has been moved to github. The original article and files have been left intact for anyone who wants them. The new way to get the extensions is to open terminal and do the following:
git clone https://github.com/stormdragon2976/ttytter-extensions
To add an extension to your .ttytterrc, the soundpack for example, you would do:
ext=/home/USERNAME/ttytter-extensions/soundpack.pl
And now back to the original article already in progress…
One of the very numerous awesome things about the greatest Twitter client in the world, TTYtter, is its ability to use extensions. extensions are third party add ons for TTYtter that add functionality that hasn’t been included in the TTYtter program itself. One of the things I wanted in TTYtter was sound alerts for the different types of events. So, with some help from TTYtter’s author, Cameron Kaiser, I wrote my first TTYtter extension to add soundpack functionallity. The soundpack goes in a directory in your home folder. If you download the script by itself you may need to create this directory structure. The path to the sounds is:
~/.ttytter/sounds/soundpack-directory
My first soundpack was created using the Espeak speech synthesizer. If you would like, you can download the soundpack. Use the file names as a template to create your own soundpacks. The file names must match exactly. They are:

me.ogg
Sound to play when you post a tweet.
default.ogg
Sound when you receive a new tweet
dm.ogg
Sound when you receive a direct message
search.ogg
sound when you get new results for what ever you are tracking
reply.ogg
sound when someone mentions you

The soundpack can be named anything you like and must be placed in:
~/.ttytter/sounds/
To get your chosen sound pack to load when TTYtter starts, add the line:
extpref_soundpack=sound-pack-name
to your .ttytterrc. Alternatively you can just rename your chosen sound pack to:
default/
and it will load with no modification needed in the .ttytterrc file.
Usually I put all the extensions I use in the ~/.ttytter/ directory so it keeps everything nice and tidy. If you would like to use the full pack of extensions that I use I have created a convenient package that has everything already set up in it. Just extract the folder in your home directory and set up your .ttytterrc file to point to the extensions. If you have previously installed TTYtter using my previous post, you only need to add a line and the notification type for the soundpack. Open terminal and type:
gedit .ttytterrc
Somewhere in the file above the notify information, add the following replacing USER with your user name, the name of your home directory:
exts=/home/USER/.ttytter/soundpack.pl,/home/USER/.ttytter/timestamp.pl,/home/USER/.ttytter/groups.pl
Next find the line that reads:
notifytype=libnotify
and chage it to:
notifytype=soundpack,libnotify
save the file and everything should just work when you open TTYtter.
Included in the pack are the soundpack script, a timestamp script originally written by @vkoser and heavily modified by me, and a groups extention also written by @vkoser. when you install the pack there is a default group created with @ttytter, myself, and some other extention writers in it. If you follow any of us our tweets will be stored in the ttytter group. For help with group commands type:
/grouphelp
If you would like an automated way to create your .ttytterrc using all the extensions then check out http://www.stormdragon.us/ttytterrc/. Note that it assumes you will be using both libnotify and the soundpack extension. If you don’t want to use libnotify edit the file and remove it from the notifytype line.

Help Power my blog posts, keep my caffeine buzz going strong!

Command Line Spell Checker

Wednesday, August 4th, 2010

Advertisements

Sometimes you may want to spell check a word without having to open a browser or a word processor. In a situation the command line can once again come to the rescue. To get the spell checker, in a terminal, type:
sudo apt-get install hunspell hunspell-en-us
After the installation has completed you can do:
hunspell
and type in each word you want checked. If the word is spelled correctly it will display *. If the word is not correct it will offer suggestions. Another way to check a word is to type:
echo “word” | hunspell
To make things even easier, you can create a file named spellcheck in ~/bin/ and add the following lines:
#!/bin/bash
echo “$@” | hunspell
exit 0
Save the file and change its permissions by typing:
chmod 700 ~/bin/spellcheck
Now you can check words by typing:
spellcheck word to check
the above line should yield 3 * symbols. So, the next time you need to check a single word to paste in to an application, open a terminal and get the correct spelling in a few seconds.

Help Power my blog posts, keep my caffeine buzz going strong!

TTYtter, an Awesome Console Based Twitter Client

Thursday, March 25th, 2010

Advertisements

TTYtter is a great command line Twitter client. To get it up and running to its optimal capabilities can take a little work, especially if you would like to get pop up notifications on your desktop with libnotify. So, here is a guide that will show you how to get it all working. Even if you are normally a GUI only sort of person I would still like to suggest you give it a try. TTYtter is my favorite Twitter client. These instructions work on Ubuntu 9.10 Karmic and later and should work on other systems with minimal modification.
If you are a Vinux user, or if you have added the Vinux PPA, you can install TTYtter by opening terminal and typing:
sudo apt-get update
sudo apt-get install ttytter
To install TTYtter manually with readline support and get the curl package open terminal and type:
sudo apt-get install libterm-readline-gnu-perl curl
Arch Linux users also need the perl-term-readkey package:
pacman -S perl-term-readkey
If you use the readline package above you will need to set your PERL_RL variable. To do this open terminal and type:
gedit .bashrc
When the file opens add the following line to the end:
export PERL_RL=Gnu
Save the file and reload it by typing:
source .bashrc
In 1.1.6 and later, you can install a TTYtter specific readline called Term::ReadLine::TTYtter. To do this, go to CPan and download the package. Extract and install the package by opening terminal and typing:
tar xzvf Downloads/Term-ReadLine-TTYtter-1.2.tar.gz
cd TTYtterReadLine/
perl Makefile.PL
sudo make install
Note that the number in the .tar.gz file will change as newer versions are released.
Now, to download TTYtter:
sudo wget -O /usr/bin/ttytter http://www.floodgap.com/software/ttytter/ttytter.txt
sudo chmod 755 /usr/bin/ttytter
If you do not have system wide access save it to ~/bin/ttytter instead of /usr/bin/ttytter and use chmod 700 instead of 755. It may be necessary to create the ~/bin directory.
If you would like to get everything up and running as quickly as possible with extensions from several different authors, you can download the ttytter-extensions pack. Read this article for more infromation. If you install the extensions, you can visit the .ttytterrc generation page to create the .ttytterrc settings file in a few simple steps. When your .ttytterrc file has been placed you can then start the program by typing:
ttytter
in a terminal. For complete instructions on using TTYtter, commands, menu codes, etc please read the TTYtter home page.
If, however, you want to set everything up manually, read on. TTYtter is now installed but missing some of its coolness. If you were to launch it by typing:
ttytter
You would have to also include some arguments to get it going if you want to use things like readline. It’s much better to save this information in a ~/.ttytterrc file. So, here is the ultimate .ttytter file. If you do not plan to use the notifications with libnotify or libnotifyperl you can leave out the notification and exts lines. Copy and paste the following in to a file called .ttytterrc replace USER with the name of your home directory:
#TTYtter settings
#show replies in timeline
mentions=1
#Open images with Eye of Gnome
avatar=eog %U&
#Open URLs with Firefox
urlopen=firefox %U&
#let TTYtter decide how often to check for new tweets
pause=auto
#Use ANSI color
ansi=1
#Check version on start up
vcheck=1
#Number of retries to connect to Twitter
hold=15
#\r and \n create a new line
newline=1
#answer y or Y to post your tweet
verify=1
#use readline support. Change 1 to a list of followers in quotes for tab completion support
readline=1
#Enable word wrap
wrap=1
#Add the libnotifyperl extension
exts=/home/USER/libnotifyperl/libnotifyperl.pl
#Set notification service(s)
notifytype=libnotifyperl
#Set types of tweets for which you would like to receive notifications
notifies=dm,me,reply,search,default
#end TTYtter settings
The newest method of getting desktop notifications doesn’t require patching libnotify. You can still use that method if you would like, and the instructions are left for reference below this new method. The new way is to use an extension written by Colindean which does notifications using Gtk2::Notify. To get it:
sudo apt-get install git-core libgtk2-notify-perl
make sure you are in your home directory by typing:
cd
and then do:
git clone http://github.com/colindean/ttytter-libnotifyperl.git
The old way to enable notifications takes a little more work. The notify-send package is available from the repository, but for some reason a patch that
adds required functionality has not been added in to the distributed version. So, instead of using the standard package, we have to roll our own. If you are not sure if you already have it installed, in terminal type:
sudo apt-get remove libnotify-bin
To build the libnotify-bin package and apply the patch type the following in terminal:
cd
apt-get source libnotify-bin
sudo apt-get install gtk-doc-tools
sudo apt-get build-dep libnotify
then download this patch. You will probably need to right click the link and select "save link as". After the file has finished downloading:
cd libnotify-0.4.5/
The number in the directory name above may change as new versions are released. If you type libnotify and press tab it should complete the name, then press enter to get in to the directory. Then, apply the patch. My files save in ~/Downloads if your files download to another location you will need to alter the path in the next command to point to the downloaded file:
patch -p0 < ../Downloads/notify-send-support_body_from_file.patch
./autogen.sh
make
sudo make install
I had to restart before notifications worked as expected. Now TTYtter is installed and should work with its ultimate coolness factors enabled. Enjoy, but be warned, TTYtter will be your new favorite Twitter client after five minutes of use. For instructions check out http://www.floodgap.com/software/ttytter/.

Help Power my blog posts, keep my caffeine buzz going strong!

Commanding the Command Line (Part 2)

Sunday, January 17th, 2010

Advertisements

This is part two of a discussion of accomplishing your hearts desire with out the use of a GUI. It’s back to the console for us as we dive in to such fun things as web browsing, instant messaging, and text editing.

Instant Messaging with Finch

Pidgin and Finch are closely connected. finch is the command line version of Pidgin. So, the way I handle setting up accounts is with Pidgin. Then, in the console launch by typing finch. The first time you run it you will be presented with the accounts list. Use highlight tracking in Speakup because it works better with Finch. Press space on each account you want activated. Move through them with the up and down arrow keys. When you activate an account it will say X to show that it is checked. When you have activated all of your accounts, press alt+a to be taken in to a menu with items like buddy list, plugins, sounds, etc. Select the sound option and tab until you find the first sound option, probably "Someone says your name in chat". Press space to check each item for which you would like to have sound. Use the up and down arrows to navigate the list. After selecting the sounds you want, press alt+a to get back to the menu. I must say that I have never successfully gotten sounds to work in Finch but I know people who have, so it’s just my problem apparently. Select Plugins and check the plugins you would like to activate. Most of the plugins that work in Pidgin also work in Finch. This is a good time to mention my favorite sets of plugins. Some of these only work with Pidgin, but I will include them anyway. Pidgin-musictracker displays your currently playing track in Pidgin. Pidgin-plugin-pack, lots and lots of useful plugins. Pidgin-mbpurple, adds Twitter and a couple of other things to Pidgin. To get them all:
sudo apt-get install pidgin-plugin-pack pidgin-musictracker pidgin-mbpurple
When you have the plugins configured the way you want them, press alt+a to get back to the menu. If you are not on your list of groups that contain your contacts, press tab until you get to it. Only buddies who are on-line will show up. To expand a group press space and to close it press space again on the group title. If you press f10 you will get another menu with things like add buddy in it. If you would like to turn off time stamps, while chatting with someone press f10 and press enter on show time stamps. To exit Finch press alt+q.

Web Browsing with Elinks

To get elinks, in Ubuntu, type:
sudo apt-get install elinks
When you first install Elinks, it takes some configuring to get it working optimally with Speakup or any other console screen reader. To launch it type:
elinks
If it is the first time you will get a welcome message. Press enter to go to the next screen. Here it will ask for a URL. Press escape to get into its menus. In Speakup, it is a good idea to turn on highlight tracking if you haven’t already. Press right arrow to get to the Setup menu, then down to Options Manager and press space to activate it

Numbered Links

Move down to Document and press space to activate it then down to browsing and press space again. Go down to links and press space. Move down through the menu until you find Numbered Links and press tab until you get to Edit then press enter. For some reason these selections do not read exactly right. when I was on the Edit option, for example, it said "Info Edit". Press backspace to remove the 0 and type the number 1 in its place and press enter. Now links on pages will be numbered. To activate a numbered link type its number and press enter then enter again to activate it.

Turn Off Frames

Press down arrow until you get to Html Rendering and press space. Go down to Show Frames and tab to the Edit option and press enter. Change the 1 to 0 and press enter.

Remember to Save

When you have finished setting options, be sure to save. Tab until you get to the save option and press enter. In this case, Speakup read it as "Search Save". You will know you did it right if you get a message about the configuration being written successfully.

Tips and Tricks

You can launch elinks with an address so when it opens you will go directly to a web page instead of having to type in the address. for example:
elinks http://www.stormdragon.us/
or:
elinks stormdragon.us
To enter a new URL press g. If you would like to be able to copy the current URL, press shift G. You can use screen’s excellent copy feature to get the current address.

Email with Alpine

To get Alpine, in Ubuntu, type:
sudo apt-get install alpine
To launch Alpine type:
alpine
the first time it runs it will create a mail folder and show you a welcome message. Press enter to get to the main menu, then s for setup and c for configure. If you want to use Alpine with your gmail account, there is an excellent guide that shows you how. If you get imap errors when trying to retrieve your email, open the .pinerc file and search for the line that reads:
inbox-path={imap.gmail.com/ssl/user=YourEmailAddress@gmail.com}
Remove any extra characters after the right brace } and save the file. It should now work correctly. Alpine works very well with Speakup and the menus are clear and not difficult to follow.

Help Power my blog posts, keep my caffeine buzz going strong!