Showing posts with label HowTos. Show all posts
Showing posts with label HowTos. Show all posts

Thursday, May 10, 2012

Use wget to recursively get contents of a directory

Sometimes, it's just necessary to explore the directory space on a remote dir to know what are the specific keys that can be queried individually.
This is particularly convenient in the case of cloud instance metadata where one would like to find out what are all the metadata keys that are available for a given instance on a given cloud.

So, to download the complete directory tree recursively, use the following command (this example uses the 'default' cloud instance metadata server):

$ wget -rk Is http://169.254.169.254/latest/meta-data/

Thursday, January 20, 2011

Installing Ubuntu 10.04 Enterprise Cloud (on Dell PowerEdge R510 using iDRAC6)

This is done as a two step process - first, we need to configure the machine, then we can actually install Ubuntu.

1. The network setup here is that each cluster node has two network cards, a local and a public one, but all of the public traffic is, initially, routed through the cluster's head node. So, in order to access Dell's iDRAC6 on the worker nodes, it is necessary to first setup port forwarding through the head node for HTTPS and VNC:
(local): sudo ssh -L 443:[node IP]:443 -L 5900:[node IP]:5900 -l [head node user name]  -N [head node IP]


2. Open https://localhost:443 and enable Virtual Media -> Status -> Auto Attach under Console/Media -> Configuration. This will allow us to actually mount a CD-ROM as a virtual device to the node. 

3. Launch the node's virtual console from the Properties tab and reboot the system; load BIOS and disable internal interfaces, disable memory checking, and enable hardware virtualization

4. On the head node, download and mount bootable FreeDOS ISO as a virtual CD for the node so we can boot off of it:
(head node): sudo vmcli -r [node IP]  -u root -p -c [path to FreeDOS ISO on head node]

5. Boot FreeDOS, through the Virtual Console, select 'Install to hard drive', then run from CD (this will enable networking):
(node): UX_Diag, uediag.exe, -mba 1

Now, the machine is ready to have an OS of choice installed.
6. Mount Ubuntu Enterprise Cloud ISO as a virtual CD from the head node again so we can boot off of it and install:
(head node): sudo vmcli -r [node IP] -u root -p -c [path to Ubuntu ISO on hed node]

7. Reboot from virtual console, enter BIOS and choose CD as the first boot device; boot into Ubuntu configuration screen and install Ubuntu. Subsequent instructions on how to install Ubuntu Enterprise Cloud are available here.



Wednesday, December 01, 2010

Create a .mo file from .po file for i18n

Quite simple (on a OS X 10.6, at least), simply run:
msgfmt -o [output_file].mo [input_file].po

Tuesday, January 26, 2010

Monitor network traffic on OpenSolaris from command line

To check a summary of network activity for a NIC, use:
# netstat -i 1
    input   xnf0      output       input  (Total)    output
packets errs  packets errs  colls  packets errs  packets errs  colls
1111615 0     745655  0     0      1111684 0     745724  0     0    
399     0     306     0     0      399     0     306     0     0    
416     0     343     0     0      416     0     343     0     0 


To expolore actual packets crossing the network, use snoop command. It captures both TCP and UDP traffic. It is a tool that is shipped with Solaris.

Here is sample output:
# snoop
Using device xnf0 (promiscuous mode)
cbcb-vs.umiacs.umd.edu -> domU-12-31-39-04-EC-47.compute-1.internal TCP D=60088 S=8021 Ack=4204280156 Seq=2401233531 Len=1460 Win=92
domU-12-31-39-04-EC-47.compute-1.internal -> cbcb-vs.umiacs.umd.edu TCP D=8021 S=60088 Ack=2401246671 Seq=4204280156 Len=0 Win=49640 Options=

domU-12-31-39-04-EC-47.compute-1.internal -> dhcp243113.rollins.emory.edu TCP D=49769 S=22 Push Ack=4234202219 Seq=2467318705 Len=192 Win=49232




It shows source and destination servers, type of traffic, source and destination ports, as well as some packet info.

Wednesday, June 10, 2009

Add 2nd disk in VMware

1. Add a second disk to the guest OS through the VM manager
2. Boot the guest OS and go to Control Panel->Administrative Tools->Computer Management->Disk Management
3. Right click the new partition and initialize it.

Thursday, June 21, 2007

Using my code with Java packages

1. After having created Java packages, copy over the entire directory structure to desired machine (e.g., source files are in /home/afgane/dBLAST/src/com/dBLAST/util).
2. In order to compile the code, in base dir (e.g., /home/afgane/dBLAST), execute
javac -d bin/ src/com/dBLAST/util/*.java
The -d option specifies where to store class files. It will create all the package subdirectories from the specified folder (e.g., by specifying bin/, it will create bin/com/dBLAST/util/ and put all class files there).
3. In order to execute the code, first you must export directory where class files are. This can be done either by editing .bashrc file and adding a line such as the following one to it
export CLASSPATH=/home/afgane/dBLAST/bin/:$CLASSPATH
Alternatively, you can do it manually and executing that same line for each login session.
4. Finally, run the code by executing java com.dBLAST.util.DynamicBLAST_6 props.properties, for example from any directory.

Tuesday, June 19, 2007

Installing Mozart Oz and Cygwin on Windows XP

1. Mozart-Oz needs to be installed using typical Windows installation procedure
2. Cygwin needs to be installed using typical Windows installation (this is bare bones, so install packages such as vi and gcc - also, 'more' command does not work in cygwin so create alias in .bashrc file to use 'less' command then typing 'more'). Windows drives can be accessed from cygwin by going to /cygdrive directory.
3. Emacs needs to be installed. Install Windows version (not the cygwin package).
4. Run addpm.exe in emacs bin subdirectory from windows explorer. This will integrate/install emacs into the Windows environment.
5. Create symbolic link in /usr/bin to point to emacs (e.g., ls -s /cygdrive/c/Program\ Files/emacs/bin/emacs.exe emacs)
6. Define environment variable OZEMACS in Windows (Ctlr Panel->System->Advanced->Env. Var) to point to emacs.exe.
7. Start cygwin and type oz to get going...

Thursday, May 10, 2007

Add second y axis on a chart in Excel

In Excel 2007:
Plot two sets of data on a single chart.
Then, you must select data series you wish to plot on the second axis by either clicking on it on the chart or selecting it from a drop down menu in top left corner under Layout tab. Then click 'Format Selection' under Layout tab and select "Plot on Secondary Axis".

In Excel 2003 and earlier:
Select chart, press Ctrl+1 and proceed with data selection...

Note: that not all charts support this feature.

Wednesday, May 09, 2007

Format elapsed time in excel

I have a set of times saved in seconds and fractions of a second. I want to be able to transpose that into something that can be understood easily, such as hours:minutes:seconds
Because Excel does not provide automatic support to measure elapsed time, this unfortunately needs to be done by hand.
Sample input data set (in columns A1-A4):
4508.507
4452.111
4423.425
4592.724

Sample output:
1:15:8.507
1:14:12.111
1:13:43.425
1:16:32.724

Formula (for first value only (i.e., in cell A1)
=INT(A1/3600)&":"&RIGHT("00"&MOD(INT(A1/60),60),2)&":"&ROUND(MOD(A1, 60),3)

Cell value (e.g., A1) can be replaced with things such as SUM (cell range), AVERAGE (cell range), MAX (cell range) to get formatting of the result of processing a range of cell values.

Sunday, February 25, 2007

Formatting database for BLAST

Unformatted databases can be downloaded from ftp://ftp.ncbi.nlm.nih.gov/blast/db/FASTA/, while formatted ones from ftp://ftp.ncbi.nlm.nih.gov/blast/db/.
Command to use to format a database:
formatdb -i input_db -p F -o T for nucleotide
formatdb -i input_db -p T -o T for protein

For yeast.nt use: formatdb -i yeast.nt -p T -o T
For nr use: formatdb -i nr -p T -o T

Wednesday, February 21, 2007

Trying to submit a simple job to new installation of Globus, I got the following error:

globusrun-ws -F wave.cis.uab.edu -submit -s -c /bin/date
Delegating user credentials...Done.
Submitting job...Done.
Job ID: uuid:a8109b36-c203-11db-a449-00123f2a7564
Termination time: 02/22/2007 23:31 GMT
Current job state: Failed
Destroying job...Done.
Cleaning up any delegated credentials...Done.
globusrun-ws: Job failed: Error code: 201
Script stderr:
sudo: sorry, you must have a tty to run sudo


If sudoers file has properly been edited and contains necessary lines and this happend, it is due to default Fedora sudoers setup. Edit sudoers file (Command: /usr/sbin/visudo -f /etc/sudoers) and comment out the following line:
Defaults requiretty

Wednesday, January 31, 2007

Installing Globus Toolkit (4.0.3) Gotchas

After following the installation documentation for installing GT 4.0.3 from source, I kept getting the following error during the make part of installation: db.c:40:17: error: sql.h: No such file or directory

(all this as root, except GT install of course)
This required installing iODBC driver (including driver manager RPM and RPM Developers Kit) from here (use command: rpm -ivv rpmName).
Also, psqlODBC driver needs to be installed. Download the source and follow the standard installation procedure:

tar xvzf psqlodbc-[version].tar.gz
cd psqlodbc-[version]
./configure --with-iodbc --enable-pthreads
make
make install

Then, run globus related ./configure and make

Monday, January 29, 2007

MediaWiki - changing sidebar menu

Found solution here by Tom Sherman.

Gist of it is the following though (in case original page moves):
"On the off chance that you’re here because you actually want to modify your wiki’s navigation links (and not just read my complaining), I recommend that you modify the existing MediaWiki URLs and not try to create new ones. That’s what I did. Simple instructions:

1. Go to Special:Allmessages.
2. Choose a link you’ll modify. I decided I didn’t want the “Community portal” link, so that meant I would modify the:
* portal page [MediaWiki:portal] (do an in-page find on the Special:Allmessages page). Modify the existing text to change what will be rendered in the menu as the link text.
* portal-url page [MediaWiki:portal-url]. Modify the existing text to change what will be rendered in the menu as the link URL (can be internal wiki page or external URL).
3. After you’ve edited, make sure to do a full-refresh of your the page or clear your browser cache. MediaWiki is very finicky about this.

Remember, you have the choice of any of the existing links to modify. Here they are:
link text | link URL
mainpage | mainpage
portal | portal-url
currentevents | currentevents-url
recentchanges | recentchanges-url
randompage | randompage-url
help | helppage
sitesupport | sitesupport-url

Even though the pages I modified were “portal” and “portal-url,” they now have nothing to do with that topic. Those are simply the references in the database."