As the doctor gone rogue

October 15, 2016

Find files and listing details on Linux

Filed under: bash, miscellaneous, ubuntu — Tags: , , , , , — hypotheses @ 12:01 pm

One common task that we always have to do relatively often is to find the location of some specific files. Although you may have some clues that those files are located in your current working directory, “.” symbolic link used in the command below, you may have no clue to which sub-folder your files are.

(more…)

April 27, 2016

Encrypt a few files or folder on OsX

Filed under: bash, miscellaneous, OsX, SysAdmin — hypotheses @ 4:00 pm

May be you are working on a sensitive data, or just want to secure your personal data on your personal computers. Mac offers the whole hard disk encryption when you install the system, as well as, encryption of your backup through “Time Machine”. However, there are times that you might want to add an extra security to your file. May be you save some of the files to Dropbox or Google Drive, and the file might contain your personal health information that you would not want just anyone to be able to simply read it.

There’s a simple tool in OsX that can help you do this.

zip -e [output.zip] [file-to-be-encrypt]

zip utility will ask you to create a password. The stronger the password. The harder it will be to crack it. However, make sure you will remember the password, too. For this reason, I recommend you to use a password manager, e.g. LastPass is one of an excellent and easy to use tool with several browser integration for both mobile device and personal computer.

Just for the peace of mind. The encryption algorithm in zip might not be very strong. But at least, you save some disk space, and there’s one more extra-security of a password protection that you have to go through before accessing the content of the file.

April 24, 2016

Write a Ubuntu Linux USB boot disk

Filed under: miscellaneous, OsX, SysAdmin, ubuntu — hypotheses @ 8:47 pm

Getting the Linux Image

You’ll get an iso file from your preferred repository. Following the link to the Ubuntu mirror at KMUTT in Thailand.
Ubuntu 14.04.4 LTS (Trusty Tahr)
Ubuntu 16.04 LTS Xenial Xerus

Convert iso to img

hdiutil convert -format UDRW -o ubuntu-16.04-server-amd64.img ubuntu-16.04-server-amd64.iso

See man hdiutil for detail about the command

Create a bootable USB drive

  • plug the USB drive into your computer and find out which mount point it is mounted to.
diskutil list

This will show the list of all drives mounted to your system right now. The description of which drive is a UBS drive should be quite clear.
– Unmount the disk before we proceed to write a bootable image on it.

# unmount it
diskutil unmount /dev/disk2
  • copy the disk image to your usb drive.
sudo dd if=ubuntu-16.04-server-amd64.img.dmg of=/dev/rdisk2 bs=1m

With /dev/rdisk2 instead of /dev/disk2, you are writing the raw data to the USB drive which will be several folds faster than writing through the buffered /dev/disk2 [ref]

Eject the USB drive

  • After writing the image, a diaglog box will alert you that the disk is not readable. Simple eject the disk.
  • Alternatively, at the command diskutil eject /dev/disk2

April 14, 2016

How to reset a root password?

Filed under: miscellaneous, ubuntu, Virtual Machine — Tags: , , — hypotheses @ 5:52 am

What do you do when you forget the “root” account password?
Install new OS is not always a good idea. As long as you still have physical access to the computer, it is somewhat possible to try the followings. Depending on whether you are working with Mac or Linux. See the detail and additional reference through the links below.
OsX:
  1. Restart the Mac while holding down the Option key, and double-click the icon for the Recovery partition. …
  2. Choose Utilities > Terminal.
  3. In Terminal, type resetpassword .
Ubuntu:
  1. Reboot your computer.
  2. Hold Shift during boot to start GRUB menu.
  3. Highlight your image and press E to edit.
  4. Find the line starting with “linux” and append rw init=/bin/bash at the end of that line.
  5. Press Ctrl + X to boot.
  6. Type in passwd username.
  7. Set your password.

October 8, 2015

apt-get through proxy server

Filed under: bash, miscellaneous, Virtual Machine — hypotheses @ 3:51 am

Again working behind firewall through proxy server is sometimes troublesome.

normally, you can export “http_proxy” to set a proxy for most process. However, to install software with apt-get, if the previous method doesn’t work.

From this page, you can try adding the configuration in a folder /etc/apt/apt.conf.d/  95proxies (more…)

July 3, 2014

Homebrew

Filed under: bash, miscellaneous — Tags: , , , — hypotheses @ 5:50 am

I bought a MacBook pro for work because of the similarity between Linux terminal and Mac terminal. However, if this is the only justification for buying a macbook, I should have thought again.

Superficially, OsX and Linux might look similar. However, the libraries, packages, machinery inside is very different. For example, there is no “wget” on Mac. Then, how can I download anything through a terminal. One solution after probing around that I came up with a while ago was to use “homebrew

I’m not going to cover the installation of homebrew here, but

If you are behind a proxy server, to install wget


$ sudo http_proxy=http://proxyUser:proxyPassword@proxyServer:port brew install wget

You can find more detail about using homebrew at https://github.com/Homebrew/homebrew/blob/master/Library/Contributions/manpages/brew.1.md

 

June 21, 2013

How to install software or upgrade from old unsupported release? – Ask Ubuntu

Filed under: miscellaneous — Tags: , , — hypotheses @ 10:34 pm

I'm trying to install CNVWorkshop (cnv.chop.edu), but now facing problem of running Ubuntu 10.10 which has faced the end-of-life since April 2013. So, now running "sudo apt-get install" anything would not work, since the repo was set to look for files from archive.ubuntu.com.
AAfter spending sometimes 'google' as usual, here's where I end up.

Not that I intended not to upgrade to a newer release, but this is probably a relatively faster way to deploy another software that I still need to use.

sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
sudo apt-get update && sudo apt-get dist-upgrade

 

via How to install software or upgrade from old unsupported release? – Ask Ubuntu.

January 19, 2012

Biological Sequence Analysis (1)

Filed under: genetics, miscellaneous — Tags: , — hypotheses @ 1:47 pm

NHGRI started a series of lectures on Current Topics in Genome Analysis 2012 two weeks ago. For more info you can find out at http://www.genome.gov/12514288.  Youtube videos are also available for you to watch. This week’s lecture is about “Biological Sequence Analysis” by Andy Baxevanis.   My notes of the talk are summarized here.  The main topic of the talk involves biological sequence alignment and alignment tools and algorithms, including BLAST.  This is a pretty good lecture if you have been away from BLAST for a while and a good introduction for people who are new to genetics.

As a rule of thumb, and a general idea of what you should remember. When you are doing local sequence alignment, you will have to encounter with several matrix of scoring the sequence similarity.

–          Several alignments scoring matrix exists, e.g. PAM46, BLOSUM62. The number following the scoring matrix name is how the two sequence similarity should be “at most”. To look for more distantly related sequence, use the scoring matrix with lower number.

–          Gap: local alignment should allow at least 1 in every 20 basepair.

–          The return results from BLAST are those results that passed the scoring threshold. This doesn’t imply significant level. Some of these results, however, are considered statistically significant.

–          To assess the biological significance, “Karlin-Altschul Equation”, a normalized probability, as a function of # of letters in the query, # of letters in the database, and the size of search space. This “E-value” represents the number of false positive, and you want this to be as low as possible.
AS A RULE:

  • Look for E < 10E-6 for nucleotide BLAST
  • Look for E < 10E-3 for protein BLAST

–          As a reference for human genome RefSeq is a good starting place for BLAST.  RefSeq provides a single reference sequence for each molecule of the central dogma (DNA, mRNA, protein).  The database is non-redundant, updated to reflect the current knowledge of sequence data and biology, and is being curated.

–          Options to consider changing

  • Expected threshold: change the E-value as suggested above.
  • Matrix: change this to reflect how similar of the sequence you want to find.
  • Filter: Always filter out region with low complexity, e.g. homopolymeric region. These regions can confound the significant level of the results. (more false positive)

–          Identities: For protein based search, look for at least 25% identity. For nucleotide, look for sequence with at least 75% identity!

–         BLAT is the tool for finding location of an unknown sequence, or gene, e.g. exon, intron, promoter or unknown region in the genome.  BLAT: Blast Like Alignment Tool, much faster than BLAST, can find exact match of sequence down to L=33.  When looking for sequence fragments or unknown genes, BLAT is a good tool to start looking for location of these sequences in the genome. BLAT is available on UCSC Genome Browser.

January 4, 2012

Error running SAS9.2 in Windows7 – non-adminstrator user

Filed under: miscellaneous, SAS — Tags: — hypotheses @ 11:09 am

SAS 9.2 error in windows 7 – non administrator user

I recently installed SAS 9.2 on a Windows 7 machine. I used administrator account to install SAS, believing that I chose the option that allow everyone on the computer to use it (if such option exists). However, when I tried to run SAS using the regular user account (my everyday use account), I did get an error message that

“User does not have appropriate authorization level for library SASUSER”

I tried to look for solution on the internet and landed on Larry’s thing page. Larry wrote about a problem with SAS 9.2 when running in non-administrator mode. You can read the original post here.  http://larrysthings.net/2011/06/15/sas-92-error-in-windows-7-non-administrator-user/

“So basically the problem is that the sasv9.cfg file has the “MYSASFILES” and SASUSER variable set to the administrator account folders during the installation, not to some generally accessible location.   The easy fix is to create a folder , i.e. c:\sas , make it fully writable by your users, then modify the sasv9.cfg file (located: “C:\Program Files\SAS9_2\SASFoundation\9.2\nls\en\SASV9.CFG” )

Look for MYSASFILES and SASUSER and change it to c:\sas”
The problem for me is that there is no “c:\sas”. So, I’m guessing that it might be a problem with other user specific folder. When I looked inside C:\Users\[ADMIN]\Documents. I saw the extra folder “My SAS Files(32)”, where as under my C:\Users\Bhoom\Documents, there was no such folder.

The fix I did was to copy the whole \My SAS Files(32) from the Admin account to my local account. This seems to fix the problem with SAS, and it started up normally without any additional problem.

 

April 23, 2010

The Sopranos

Filed under: miscellaneous — Tags: , — hypotheses @ 4:48 am

“Sigh…I don’t know. The morning the day I got sick I’ve been thinking…it’s good to be in something from the ground floor. I came too late for that. I know. But, lately I’m getting the feeling that I came in at the end. The best is over.”

“I think about my father. He never reached heights like me. But in a lot of way, he had it better. He had his people. They had their standard. They had their pride.”

Tony Sopranos

Modern society seems to make life more and more complicated. Modern statistical techniques seem to do the same thing to this society.

Blog at WordPress.com.