Linux
lslt Bash Function
by admin on Jan.26, 2013, under Linux
I’m always typing: ls -lhatr | tail
I decided this was getting old. ‘Alias’ was not going to really do what I wanted, so I made a little bash function instead, which can be put in your .bashrc, etc. Simple – but handy. And (of course) maintains colors.
The full script version :
#!/bin/bash
# List the last N items in specified directory in
# reverse time order (newest on bottom).
#
# Note however, the 'alias' commanad alone will not correctly handle args.
if [ $# -lt 1 ]
then
echo "Usage: $0 /foo N (optional)"
echo "Will perform ls -lhatr | tail -N"
exit 1
fi
dir=$1
echo "Listing $dir . . . "
ls -lhatr --color=always $dir | tail -$2
But you can achieve the same thing with a bash function, perhaps in your ~/.bashrc e.g.:
# lslt () { command ls -lhatr --color=always "$1" | tail -"$2"; }
#
# Or even fancier . . .
lslt () {
if [ $# -lt 1 ]
then
#type lslt //Works, but a nicer way is . . .
echo "Usage: lslt /foo N (optional)"
echo "Will perform ls -lhatr | tail -N"
else
command ls -lhatr --color=always "$1" | tail -"$2";
fi
}
Google Drive for Linux – grive
by admin on Jun.01, 2012, under Linux
Google has yet to release a Linux client for its new Google Drive service, but thanks to some enterprising individuals an Open Source client called grive is available at this github repo. Some additional info is available through the grive Google+ site and here.
Google Drive, similar to Dropbox and other file sharing services, allows you to store documents online, share them with others, etc. with a 5GB allocation to start with.
Getting grive for Linux
For Ubuntu 11.10 or later grive should be in your repos.
For other distros, building from source is fairly trivial, but the follow notes might be of assistance.
Building from source
Install the needed libs listed in the README, and cmake then build as below, which uses the typical cmake build process that create a Makefile, etc. (For Suse 12.2: zypper install cmake libgcrypt-devel libjson-devel curl-devel libexpat-devel boost-devel)
git clone git://github.com/Grive/grive.git
cd grive
mkdir build
cd build/
cmake ..
cd grive
make
You can run the binary from here, without running make install.
Running make install did not install the libgrive.so library correctly for me. You can verify if yours did with ldd `which grive` and see. If needed, you can install the library separately:
Installing the library
From the libgrive directory:
grive/build/libgrive$ sudo make install
#ldconfig (as root)
This should install to /usr/local/lib/libgrive.so
Rebuilding
As a note, if you relocate your git repo cmake will freak out as the paths will be wrong. Another lovely benefit of cmake. To clean up and rebuild if needed:
In your build directory:
mv grive/ grive.old
mv CMakeCache.txt CMakeCache.txt.old
cmake ..
Okay, okay – let’s use it already!
Run the resultant binary and connect it to your Google Drive via the nifty Google API. (Create a sync folder first, in which to they sync contents):
mkdir ~/Grive
cd ~/Grive
grive -a
Go to the Google link provided and then enter the API key so grive can talk to your Google Drive. Grive then downloads your drive contents to the local folder.
Now, push stuff up!
echo “Pushing this to my Google Drive.” > grive.push.test.txt
grive
View your drive contents at https://drive.google.com/#my-drive and verify your file has been pushed.
That’s all there is to syncing folders – pretty easy. You can add the -V option for more verbose log messages.
Security via Encfs
For the security conscious, encfs can transparently encrypt files stored in an encfs mounted directory. I use this to mount a encrypted folder in Dropbox to an unencrypted mount point in my home directory. Anything dropped in the mount point dir is AES encrypted and stored in the folder in Dropbox. I find this extremely useful and it integrates with Dropbox well. More information on encfs and integrating it Dropbox is here. Though I’ve not tried it yet, I see no reason it could not also be used with Google Drive folders as well.
Conclusion
Google, despite being a bit late to this game, is sure to win over many people with Google Drive especially heavy Google Docs users or who may be otherwise new to this type service. There is a lot of competition with Dropbox, Spideroak, S3, and Sky Drive – but Google has not exactly been first to market in other areas, which they then dominated. For myself, Google Drive is somewhat handy but I’ve been using Dropbox for a good while now, and Google Drive really offers me nothing more compelling feature wise than I enjoy with Dropbox. I also like Dropbox’s file recovery options (the pack rat option makes available all previous versions of an object, nothing is ever really deleted) and I like how all clients are automatically synced – no action is required. Still, options are good!
If you would like to try Dropbox, see this previous post which also links to a referral that will give you (and me) an additional 250MB of storage.
Another interesting option is SparkleShare which allows you to store your files in a git repo – be it github, gitorious or a bare repo on your own server. Very cool. The open source client is available for Linux, OSX and Windows. This is also an interesting and compelling new way to centrally save, distribute and share files.
Harvest Time Tracking
by admin on Jan.08, 2012, under Linux
Click above to get started with your 30 day trial account, which you can convert to a free forever account (limited to two projects.)
I’ve been looking for a good method for tracking time on projects and tasks. My previous solution was GnoTime, which worked relatively well, but had a few points I was unsatisfied with. Deciding to try something new Google lead to this post from which I discovered Harvest, which is a hosted time management solution. Previously, I’ve only used desktop applications such as GnoTime, Ktimetracker, etc. though I liked the idea of a web tool, as easily accessing it from both work and home was appealing, as well as mobile support for Android. Not having to sync files via Dropbox between systems was certainly appealing, and Harvest offers some very nice features including reporting and even invoicing capabilities.
Setting up a Harvest account takes about two minutes, and I had an initial project and tasks defined right away. The web interface is easy to navigate, and provides start / stop timers for each task, which is a feature I wanted. I should note this is a paid hosting service, however pricing is reasonable, there is a 30 day trial, and the website also is currently promoting “The Harvest FREE FOREVER Plan – 2 Projects, 4 Clients, & 1 User, absolutely FREE” – perfect. Update: Once signed up, you can change simply convert your 30 day trial account to the free account under you account management, upgrade settings.
But it gets better. The first day I left a timer running at work, and the next morning received an email from Harvest informing of this. Nice. Also, over the course of the first week I received some helpful emails (non-spam) to get new users started using some of the features, a web cast invite for how to do invoicing, etc. I also sent them a ticket asking about converting to the free account, and if they had a referral program, and received a response the next day. The referral program credits you time for anyone you refer, though does not credit them – though they of anyone can join the referral program. The big orange button at the top of the article is an example of one of the referral buttons you can get.
You can also export your time to a csv file, which is quite handy, and the invoicing capabilities might be extremely helpful for those needing them (I do not currently use this feature, but it is very nice it is there.)
Editing time in the web interface is flexible and easy. If a field already contains 9.43 hours, you can add or subtract time by simply appending say -4.15 and it will automatically calculate the new time, nice for reducing simple mistakes. You can use the ‘n’ hotkey to add a new task, and tab / enter to complete it.
Now, the icing on the cake would be a Linux desktop widget. While the download site has widgets for OSX and Windows, none was listed for Linux – and, unsurprisingly, the OS X one does not work when installed in plasma. However, this post pointed me to the Harvest Command Line Tool (hcl), a ruby tool designed by Zack Hobson which provides a command line interface which uses the Harvest API to allow task management via the command line. Wow. The Harvest devs are also apparently looking at providing an actual widget in the future per this feature request, but hcl is fine for me. The fact there is a useful API which is being used for tools like hcl is another huge benefit to Harvest.
Installing Harvest Command Line Tool
Installing hcl is extremely easy, as it is available as a Ruby gem. You may also install it from source via the hcl git repo.
Installing with gem was simply a matter of installing rubygems for my distro and then the hcl gem:
#zypper install rubygems
#gem install hcl
(For Ubuntu and Fedora users, this should simply be a matter of installing rubygems as well via yum or apt-get.)
Running hcl the first time prompts for your Harvest account credentials, and your Harvest subdomain – this is the yourdomain part of you yourdomain.harvestapp.com account you created earlier. You may now list your project and start / stop tasks, etc. For example:
paracelsus@linux:~> hcl tasks
1782588 1165030 Prime Enterprises – ORNL – ARM
1782588 1165024 Prime Enterprises – ORNL – Admin
1782588 1165031 Prime Enterprises – ORNL – BDS
1782588 1165029 Prime Enterprises – ORNL – DAAC
1782588 1165032 Prime Enterprises – ORNL – GPGPU
1782588 1165034 Prime Enterprises – ORNL – ITSD
1782588 1165025 Prime Enterprises – ORNL – Project Management
You can view the time for a specific day:
paracelsus@linux:~> hcl show last friday
8:09 ORNL
————-
8:09 total (as of 10:12 am)
And of course start and stop the timer for a project / task and include a log message:
paracelsus@linux:~> hcl start 1782588 1165032 Testing hcl
Started timer for Prime Enterprises – ORNL – GPGPU (0:00) (at 10:21 am)
Additional options are available via hcl –help and further usage examples are available in the documentation at git hub, such as: https://github.com/zenhob/hcl/blob/master/README.markdown
Summary
So far I am quite impressed with Harvest. It provides the features I needed, and the inclusion of an API and tools like hcl are all I needed. I’m looking forward to using it over the next few weeks on my projects.
The referral program is a nice bonus. I had very good success with the Dropbox referral program, so we will see how this one goes.
If you are looking for a time tracking tool, Harvest might well be worth test driving.
From Rocksmith to Free Guitar Effects and Home Studio Recording
by admin on Dec.04, 2011, under Linux, Music, My Life
[poll id=”3″]
If you have Rocksmith for PS3 or X-Box, a Realtone guitar cable, and have a PC or Intel-based Mac, you have everything you need to extend your playing from the game into a home studio and guitar effects processing and jamming session, not just for yourself but for friends as well. Want to add vocals? No problem, just plug in that Rockband or Guitar Hero USB microphone and you can record audio too. You have everything to extend your playing from Rocksmith into endless possibilities using your home computer – and it is utterly free. (Compare that to what you have to spend for something like ProTools.)
All you need to do is download a bootable Linux CD, such as AVLinux, boot your computer with it, plug in your guitar using the realtone cable, and run the software on the CD and you can unleash a vast array of guitar audio effects (pedals), as well as easily record yourself (with multiple tracks), add vocal tracks, etc. If you have a MIDI capable drum kit or keyboard (especially with an M-Audio MIDI adapter), you can very likely use them as well.
And the best part: it’s free. There is zero cost for the software as it is based on an Open Source operating system (Linux), and Open Source applications such as Rakarrack, Guitarix, Ardour, Soundgarden and others. AVLinux also comes with commercial software, and previews of other available tools, but everything on the CD is free to use.
Here is how it works:
The realtone guitar interface cable Rocksmith uses is really just a simple USB sound card which is seen as a USB microphone by a computer or console game system. This is actually identical to other 1/4″ to USB adapters such as the Behringer UCG102 Guitar to USB interface. Linux has excellent support for USB audio devices, and the Rocksmith realtone cable uses a chipset which is support by the snd-usb-audio Linux drivers (and for Mac by OS X 10.6). Support is built in to Linux, so you can simply connect the realtone cable to a Linux system and jam away. (However, you can not connect something like the Behringer UCG102 to your PS3 or XBox to use with Rocksmith. Although they perform the same function, the game will only work with the realtone cable. Yep, lame.)
The real magic is not the cable, but Linux. If you have never used Linux, don’t be afraid. If you can download and burn a CD you can get started using Linux. You will actually find Linux itself easy enough to navigate around in, but learning to control the vast number of audio application which are now at your fingertips may take a bit longer. (You can also very likely use Garage Band for OSX, but the wealth of audio tools on AVLinux is an order of magnitude beyond this and is more comparable to ProTools and more.)
The below steps are written assuming you know nothing whatsoever about Linux. If you get stuck you will find there are many online forums where help is available. NOTE: Please see the AVLinux user manual, found on the desktop – it is an excellent guide and will quickly get you started. Also, get help from a computer geek friend – especially if they know anything about Linux. (Make sure to provide the beer.) It might seem daunting at first, given the extent of software available, some of which is very full featured, and complex. However, you should be able to at least get up and running so you can hear your guitar and uses pedal like effects pretty easily. From there you can dive into the more complex tools, like Ardour for recording, etc.
Here is how to do it:
While there are many flavors of Linux other there, and several ways you can do this, I highly recommend downloading the LiveCD version of AVLinux from here.
(For more information on other Linux versions available, see the geek notes at the end on “Other Linux Environments”. Just use AVLinux for now though unless you have reason not to.)
Make sure you download the “live” version, and burn the .iso as an image, and don’t copy the .iso file itself to the blank CD. Then, restart your computer with this CD in it. It should start up and take you to the Linux Desktop. (NOTE: If it does not, you may need to configure you computer to boot to CD first. If you are using a Mac, hold down the alt or ‘c’ key while powering on the system and until after you hear the chime.)
Be patient, it may take several minutes for the desktop to appear.
Now, simply plug in the Realtone audio cable. Next, you must configure the system to use the Realtone cable as the proper input, and the computer as the output. This is done using the Jack audio server, which can be controlled by running qjackctl. There is a little green icon on the system tray at the bottom of the screen which will start qjackctrl.
Configuring Jack is likely going to be one of the hardest parts to set up the first few times. The idea is you are patching together software audio tools, as though you were connecting them to each other using physical audio cables. You can then string together different tools. The first thing you need is to ensure the Realtone input is connected to the system output. The basic JACK configuration should look something like this:
TOP TIP: Click on the > button in Jack next to the input device to see more descriptive names for the inputs and outputs. If you just try to use the drop down menu (hw0, etc.) it is easy to get them wrong. The Realtone cable will be list as a “Rocksmith USB Guitar Adapter” or “Hercules” or “Sony Entertainment”.
Go Programming Language
by admin on May.22, 2011, under IT Adventures, Linux
The Google Go Programming Language, currently under development by Robert Griesemer, Rob Pike, and a fellow by the name of Ken Thompson looks to be quite interesting.
Some of the merits include:
- Fast compile times. Wicked fast.
Familiar C like syntax.
Ease of programming – a pseudo marriage of C and Python.
Built in concurrent process execution and messaging.
(MPI clustering and CUDA are under discussion.)
Support for AMD64, x86 and ARM
New languages come along all the time. So why should this one be any different?
Ken Thompson, and his experience with systems programming and languages, is one good reason. For another I can foresee that, for scientific computing in particular, there could be a very good future for Go. By providing an easy to learn and use programing environment, with a C and Python-like style, with easy to use messaging and concurrency and which compiles extremely fast and runs at near C speeds – there is a very good potential. If the future added to this MPI capabilities, and especially bindings for existing libraries (e.g. Thrust and SciPy ) and for CUDA – it could very well fill a perfect niche. This just might be the start of something grand.
Official Sites
Install instructions, beginning tutorials, etc.
This site also provides a cool browser based write-compile-run environment where you can achieve instant gratification with Go.
The actual Google code site.
Getting Started
To get a feel for the language and start using it immediately, you might want to read the sample hello world in the writing programs section of the install instructions.
You can execute Go programs using the above mentioned browser based compiler and run time tool.
Of course, you can also install the Go compiler and tools locally. You have two options for the compiler: the native Go compiler tool chain (6g, 6l, etc.) or gccgo, which uses gcc for the backed.
The official site has full instructions for setting up your environment. Requirements to build Go are minimal, and you can likely be up and running in minutes.
Nifty Cool Bonus: Note the following comment from the install instructions on how the Go linker works:
There is no need to list hello.6
‘s package dependencies (in this case, package fmt
) on the 6l
command line. The linker learns about them by reading hello.6
.
Other References to the language:
http://en.wikipedia.org/wiki/Go_%28programming_language%29
A reference for GO language bindings can be found at:
http://go-lang.cat-v.org/library-bindings
Scientific Computing
The suitability of Go for scientific computing is discussed in an interesting Google Groups thread here.
Syntax Highlighting
Exploring the misc/ sub directory shows the source includes syntax highlight files for Vim, Kate and other editors as well as some other goodies.