Wednesday, December 14, 2011

Remove Spaces In Files


This command is very useful.
Credits to : http://www.swflug.org/index.php?option=com_content&task=view&id=71&Itemid=47


for file in *; do mv "$file" `echo $file | sed -e 's/  */_/g' -e 's/_-_/-/g'`; done 

Wednesday, November 23, 2011

How to record Games in Linux with RecordMyDesktop and PulseAudio

This tutorial is for those of you who have been struggling to record games on Linux. On the surface, this task may sound trivial, but getting started will reveal that it isn't so easy. The current online instructions that I have found are complicated and unnecessary. In my exploration, I spent about 3 hours playing around with JACK and other resources with no luck. JACK doesn't play very well with PulseAudio which comes on the more recent Ubuntu distributions. Working around it can be quite nightmarish so here I offer you an alternative.

TASK: Record Desktop Games With Game Audio.

INSTALLATION:
The applications you will need are gtk-recordmydesktop and PulseAudioDeviceChooser. In the terminal you can install with the following line:

sudo apt-get install gtk-recordmydesktop padevchooser

or with the more friendly Ubuntu Software Center.




INSTRUCTIONS:

Once these two applications are installed, open the PulseAudioVolumeControl
Applications > Sound&Video > PulseAudio Volume Control


In this window, go to the Input Devices tab and show All Input Devices

Scroll down to Monitor of Internal Audio Analog Stereo and click the checkbox. This will change your default input audio what you normally hear as output. I lowered the volume a little for quality, but you may have different preferences.


(When you are finished, restore the default by clicking on Internal Audio Analog Stereo)

Now you can open gtk-RecordMyDesktop
Applications > Sound&Video > Desktop Recorder


I think that using gtk-RecordMyDesktop is pretty straight forward. Clicking on Advanced I modified the Performance as shown. Nothing special on the Sound tab. 

All that's left is to click Save As  to name you file, Select your Window, and then hit record!


That's how you record audio and video together.


Saturday, November 19, 2011

An idea for the future...

I want to work on developing a webapp music player that integrates MusicBrainz services. The webapp should play local files with MusicBrainz meta-data.

Wednesday, November 16, 2011

List files in FTP and Download/Unzip it

curl ftp://ftp.aoml.noaa.gov/phod/pub/IES_FTP/abaco/ > temp.txt


for each in `cat temp.txt | awk '{print $9}'`; do wget ftp://ftp.aoml.noaa.gov/phod/pub/IES_FTP/abaco/$each && unzip $each; done;

Tuesday, October 25, 2011

Exporting path...

I always seem to forget this line...

I currently have this in .bashrc, but it may not be the best place to put it.

export PATH=$PATH:/new/path/to/add:/other/new/path

Renaming file numbers

This little script will rename badly named files into nice 3 digit numbers.

For example, if you have files, 1,2,3,...10,11,12, it will rename the files into 01, 02, 03, etc.

#!/bin/bash
echo $1;
mkdir $1/output

for each in `ls $1`
do
filename=$(echo $each | cut -f1 -d '.' | tr -d '[[:digit:]]')
extension=$(echo $each | cut -f2 -d'.')
number=$(echo $each | tr -cd '[[:digit:]]')
echo $number;
cp $1/$each $1/output/$filename`printf "%03d" $((10#$number))`.$extension
done

Wednesday, October 19, 2011

I Wish There Was....

I am not one to stand out or break out from the norm, but I have an idea that I think has a lot of potential.

I think that there should be a new playlist format that explicitly uses Musicbrainz Ids... or at least a music player which allows users to see the MBID....


Friday, October 7, 2011

Script to connect to HunterNet


The connection to my university wifi is terrible and requires authentication. I have written a small script here which allows me to connect to the internet without a browser. 


#!/bin/bash


IP=$(ip addr show wlan0 | grep inet | head -n1 | cut -f6 -d ' '| cut -f1 -d '/')
MAC=$(ip addr show wlan0 | grep link | head -n1 | cut -f6 -d ' ')


echo $IP;
echo $MAC;
echo `curl -d "user=USERNAME&password=PASSWORD" https://securelogin.arubanetworks.com/cgi-bin/login?cmd=login&mac=$MAC&ip=$IP`


echo "CONNECTED!"

Tuesday, September 6, 2011

Organizing a few links...

I am beginning an android project and I just wanted a place to organize a few links.


Maven Archetype
https://github.com/akquinet/android-archetypes/wiki/android-with-test-archetype

Maven Plugin
http://code.google.com/p/maven-android-plugin/

Android SDK
http://developer.android.com/sdk/index.html

To download the correct version, run the 'android' application. You can choose which version to install from there.

Export ANDROID_HOME in your .bash_profile



Sighs.. this is looking like it will be more complicated than ever!

Thursday, August 11, 2011

Pushing an existing GIT repository to GoogleCode

In my most recent project, I started to use Github to host my code. I find GIT to be an amazing tool and I can't emphasize enough how much better GIT is than SVN.

Anyways...

Today I was trying to upload my git repository to GoogleCode to take advantage of the free bug tracker. However, I came across a little bit of trouble during this migration and so I wanted to share my little problem/solution so that others don't need to waste too much time trying to figure out what went wrong.

I was following the instructions found on this page:
http://www.servercobra.com/migrate-git-project-from-github-to-google-code/
and for the most part, it worked out very well.

A little more context
I have a project called MageComet that is already setup and versioning on Github.  I want to push my local github repository into googlecode.

Steps


1) Make sure the google code repository is using git.


2) If you took a look at the previous tutorial at the link above, the author guides you through creating a  '.netrc' file. You can give it a try and create this file, but in my experience, my machine did not use it, and thus, there were errors.

In my repository, I executed the following code:

git remote add google https://code.google.com/p/magecomet/
git push google --all

BUT, I received this error message:



error: The requested URL returned error: 403 while accessing https://code.google.com/p/magecomet//info/refs


If the previous steps worked for you, I don't think you need to continue reading... but if you still have problems go on to step 3!

3) I like having clean config files so I removed the previous remote repository and added the correct one.

git remote rm google 
git remote add google https://USER@code.google.com/p/magecomet/

4) Now if you execute  the following code, you should be promoted for a password:


git remote add google https://code.google.com/p/magecomet/
git push google --all


This password is NOT your google password, but rather the password found at this link (provided that you are logged in)

https://code.google.com/hosting/settings

5) If you enter the password, all should be go well and your repository should be pushed onto GoogleCode.


Hope that helped.




*****************
EDIT

I figured out why the .netrc file wasn't working.

This file is supposed to be a space delimited file... I had an extra colon in it for some odd reason...
The file should look like this

machine code.google.com login USER@gmail.com password PASSWORD




EDIT

Guess I posted too early, Still doesn't work so I am just going to manually put in my password...

Wednesday, August 10, 2011

Subversion CheckSum Error

I have been working with subversion again and I came across this checksum error....

I was looking for an easy way to fix it and so this is what I did.

0) Backup the changes for the corrupt file.
1) Browse to the SVN repository and delete the file.
2) Update the client version of the respository. (the file in question should be removed)
3) Make a new file and paste your changes in.
4) Commit (as a new file)

Again, Git is so much easier to use... but maybe it's because I am not using it through an Eclipse plugin...

Wednesday, July 27, 2011

Removing SVN files

Removing .svn files

find . -name ".svn" -type d -exec rm -rf {} \;


.... Git is so much easier ^.^

Sunday, July 10, 2011

Getting Started With Mahout

This is a quick tutorial on how to get started with Mahout from the svn repositories.  The first step is installing Hadoop.  There is a great tutorial at the following link.

http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/

I am currently using Hadoop 0.20.2 because Mahout does not support 0.21.0 yet. To get started, download maven2 and subversion form the ubuntu repository using the following:

sudo aptitude install maven2 
sudo aptitude install subversion

Now you can go ahead and download the latests mahout from subversion. At the time of writing, I am using Mahout 0.5-SNAPTSHOT.

svn co http://svn.apache.org/repos/asf/mahout/trunk

Next, cd into the directory and install it using maven. This will download all the necessary dependencies and build the latest jar.

mvn install

Once you have the core files installed, make sure your environment variables are set correctly. For me, this is:


export JAVA_HOME=/usr/lib/jvm/java-6-sun/
export HADOOP_CONF_DIR=/home/hadoop/hadoop-0.20.2/conf
export HADOOP_HOME=/home/hadoop/hadoop-0.20.2
export MAHOUT_CONF_DIR=/home/hadoop/mahout/src/conf

Now my current home directory looks like this:



/home/hadoop/mahout
/home/hadoop/hadoop-0.20.2

At this point Mahout should be ready to run. Switch into the directory:
/home/hadoop/mahout/bin/


and execute the mahout shell script. If all goes well, you should see all of the available functions.


Tuesday, June 21, 2011

Some more great Unix Lines!

for each in `ls | cut -f1 d '-'`; do mv $each /remoteFolder/; done


find E-GEOD-* \( ! -name dir -prune \)

Thursday, April 14, 2011

More useful Unix one line scripts

Goal: Take the 9th column of the document and count all of the lines that  have a semicolon.
cat document.txt | cut -f9 | egrep ';' | wc -l

Goal: count the number of columns in a text.
head -1 document.txt | awk '{print NF}'

Monday, April 11, 2011

Best Latex Editor On Ubuntu

I have been looking far and wide for the best Latex Editor on Ubuntu and little did I know, it was living right under my nose.

Gedit with the latex plugin is simply wonderful!

Monday, March 21, 2011

How to increase the volume on Ubuntu audio preview.

For some odd reason, the audio preview on my Ubuntu machine became inaudible. I thought that there was some missing library but I knew that it worked before and had only recently stopped working. 

I found the problem in my sound preferences.

When I hovered over a music track, the "Audio Preview" label showed up but the audio levels were near mute. Any attempt to adjust the volume with the mouse proved useless as the label would disappear once the mouse moved off the music track. 

The solution that I found was to use the keyboard. By opening the window first, and hovering over the music track, I could use the tab key to move to the slider and adjust the volume.

This solved an annoying problem and I hope it helps someone who has the same problem. 

Saturday, March 5, 2011

VIM

This feature in VIM is quite useful for viewing spreadsheet like documents.

vim document.csv
:set tabstop=60
:set nowrap