Friday, May 7, 2010
Yet another reason to love Ubuntu, multiple folder extraction
Today I needed to extract 20+ folders and I thought, I don't want to right-click over 20 times, wouldn't it be cool if I could just select all the folders, right-click and extract? Well, it worked like a charm and made my day. Now if only Ubuntu could solve the problem of all of my folders being over 2.5 Gb and taking forever to extract.
Tuesday, May 4, 2010
Your own legal ssh personal server on comcast with Ubuntu 10.04
Legal Matters
It appears to me that a personal ssh server is legal and acceptable to use [at least if you are with Comcast].The Comcast Terms of Service:
The relevant bullets under Technical restrictions are:
* use or run dedicated, stand-alone equipment or servers from the Premises that provide network content or any other services to anyone outside of your Premises local area network (“Premises LAN”), also commonly referred to as public services or servers. Examples of prohibited equipment and servers include, but are not limited to, e-mail, Web hosting, file sharing, and proxy services and servers;Also, note that the ssh port (22) is not blocked by comcast.
* use or run programs from the Premises that provide network content or any other services to anyone outside of your Premises LAN, except for personal and non-commercial residential use; (my emphasis)
How to setup a personal ssh server
This should work in many different distros and versions with only minor modification.
sudo aptitude install openssh-server
- Since I have kids with weak passwords using my computer, I only want a couple accounts to be accessible. Edit /etc/ssh/sshd_config and add something like this:
AllowUsers user1 user2 user3
This will prevent other user accounts from being accessible.
- It is generally a good idea to use a static IP address so your router knows where to send the ssh traffic. Right click your wireless icon on the panel and edit your connection. Shown to the right is a setup that is compatible with a linksys router (i.e., the router IP address is 192.168.1.1).

- Forward port 22 traffic to your statically assigned PC (see image below for router specs).
- Use a service like dyndns.com to associate a static IP address with your dynamically assigned address.
- Run ddclient to update dyndns.com.
sudo aptitude install ddclient
Here is a configuration file (/etc/ddclient.conf) that works for me:
daemon=600 use=web, web=checkip.dyndns.com/, web-skip='IP Address' login=
password= protocol=dyndns2 server=members.dyndns.org wildcard=YES jtprince.dyndns.org, bwv549.homeip.net
Now, you should be able to ssh into your home computer from anywhere in the world. Also, please note that you can do just about anything with ssh access.
Friday, April 30, 2010
Asus Eee PC 1201N Wireless WPA2 Ubuntu Lucid Lynx 10.04 Fix
I was able to use wireless on 9.10 by compiling the one talked about on newegg and elsewhere. However, I couldn't connect to the school's network. On 10.04, it appears that they are using the same driver and it has the same problems (appears to work but won't connect to my school's WPA2 network). I used Matt Price's package and it works now!
Here are the steps:
Then add these lines to /etc/apt/sources.list:
Here are the steps:
sudo add-apt-repository ppa:matt-price/mattpriceThen add these lines to /etc/apt/sources.list:
deb http://ppa.launchpad.net/matt-price/mattprice/ubuntu lucid main
deb-src http://ppa.launchpad.net/matt-price/mattprice/ubuntu lucid main
Saturday, March 6, 2010
ssh tunneling (port forwarding)
The past two places I've worked at have had a single computer that would accept outside ssh communication. However, other computers in the network also had useful things on them but could only be reached from inside the network. How to connect to these other computers directly?
ssh port forwarding allows you to open up an ssh session between you and your gateway computer. Then, you can use that port to interact with the other computers in the network. Here is an example of how to do this:
Open a terminal and type in something like this:
Then, open another terminal and you can interact with the internal server as you normally would, just by interacting with your localhost through the specified port:
Yes that is localhost. You are connecting to port 22000 on the localhost and that is being tunneled via the gateway computer to the internal server!
This works but isn't the absolute slickest setup. Anyone know the equivalent commands for .ssh/config files?
This site has some alternative methods for mounting across ssh.
ssh port forwarding allows you to open up an ssh session between you and your gateway computer. Then, you can use that port to interact with the other computers in the network. Here is an example of how to do this:
Open a terminal and type in something like this:
ssh -L<unused_port#>:<final_destination>:22 <gateway_computer>
ssh -L22000:internalserver.super.duper.com:22 gateway.super.duper.com # e.g.
# you might want to add the -N and -C flags:
ssh -N -C ...
# -N Do not execute a remote command (useful for forwarding ports)
# -C compress (for slow network connections only)
Then, open another terminal and you can interact with the internal server as you normally would, just by interacting with your localhost through the specified port:
# log in to the internal server
ssh -p 22000 localhost
# scp stuff from the internal server
scp -P 22000 localhost:~/somefile.txt ./ # copy files from the internal server to local
# mount a folder from the internal server locally using sshfs
sshfs -p 22000 localhost:/home/<user>/<internal_dir> /home/<user>/mnt -o follow_symlinks
Yes that is localhost. You are connecting to port 22000 on the localhost and that is being tunneled via the gateway computer to the internal server!
This works but isn't the absolute slickest setup. Anyone know the equivalent commands for .ssh/config files?
This site has some alternative methods for mounting across ssh.
Thursday, March 4, 2010
Fonts in rumai (wmii)
How do you know what fonts you can use in rumai or wmii?
xlsfonts will list all the fonts in the format that wmii expects:
xlsfonts > available_fonts.txt
You can use the '*' symbol to generalize. Here are some that work ok. Some are quite ugly, others OK:
-*-fixed-medium-r-*-*-18-*-*-*-*-*-*-*
-*-fixed-bold-r-*-*-12-*-*-*-*-*-*-*
-*-fixed-medium-r-*-*-12-*-*-*-*-*-*-*
lucidasans-bold-12
-adobe-helvetica-medium-r-*-*-12
-adobe-helvetica-bold-r-*-*-12
-adobe-palatino-bold-r-*-*-14
-*-lucida-bold-r-*-*-12
-*-dejavu sans mono-medium-r-*-*-14
-*-dejavu sans mono-medium-r-*-*-14
xlsfonts will list all the fonts in the format that wmii expects:
xlsfonts > available_fonts.txt
You can use the '*' symbol to generalize. Here are some that work ok. Some are quite ugly, others OK:
-*-fixed-medium-r-*-*-18-*-*-*-*-*-*-*
-*-fixed-bold-r-*-*-12-*-*-*-*-*-*-*
-*-fixed-medium-r-*-*-12-*-*-*-*-*-*-*
lucidasans-bold-12
-adobe-helvetica-medium-r-*-*-12
-adobe-helvetica-bold-r-*-*-12
-adobe-palatino-bold-r-*-*-14
-*-lucida-bold-r-*-*-12
-*-dejavu sans mono-medium-r-*-*-14
-*-dejavu sans mono-medium-r-*-*-14
Tuesday, March 2, 2010
wmii (rumai) with gnome in Ubuntu 9.10 & 10.04
NOTE: modified from here
This is a step by step to install rumai as the windows manager in gnome.
This is a step by step to install rumai as the windows manager in gnome.
- install necessary packages
- Install a good build The Ubuntu wmii packages (karmic? and jaunty?) and even the current repo can be buggy. Download a solid build (hg2474) here or here. Unpack it, go into the src directory and sudo make install.
- modify some gnome settings
- have wmii fire up at login System -> Preferences -> Startup Applications Add an entry for /usr/bin/wmii
- get rumai make sure you have ruby and rubygems. Works great with ruby 1.9. (I'm using 1.9.1)
- grab a rumai config wmiirc To make it easy for beginners, my master branch work's out of the box:
sudo apt-get install dwm-tools # for menus
sudo apt-get install libixp libx11-dev # for the install itself (necessary??)
On Lucid Lynx I needed to install these two packages also:
sudo apt-get install 9base libxft2-dev # plan 9 file system (need on 10.04)
gconftool-2 -s /apps/nautilus/preferences/show_desktop --type bool false
gconftool-2 -s /desktop/gnome/background/draw_background --type bool false
## Tell gnome to use wmii as the window manager
gconftool-2 -s /desktop/gnome/session/required_components/windowmanager wmii --type string
gem install rumai
Also make sure your rubygems are executable by adding something like this to your .bashrc:
export PATH="$PATH:$HOME/.gem/ruby/`ruby -e 'print RUBY_VERSION'`/bin"
git clone git://github.com/jtprince/wmiirc.git ~/.wmii
For more advanced possibilities, you'll want to start with sunaku's and then branch, etc.:
git clone git://github.com/sunaku/wmiirc.git ~/.wmii
Now make a soft link to the file this wmii will be looking in:
ln -s ~/.wmii ~/.wmii-hg
Now logout and back in and it should work.
This is pretty stable and works pretty well. If wmii crashes, restart in a terminal or from the panel (add a "run application") with the command "wmii" or "killall wmii && wmii".
Friday, January 8, 2010
multifactorial plotting in R: lattice
I've mentioned before in personal communications that if you have lots of factors in a data set you can just flatten out the data set and then use openoffice data pilot to pivot around different factors (also can be done in ruby with Ruport and 'pivot'). This is a good method.
There is a much better method I recently came across: "trellis plots". The package in R is called lattice.
This is clearly the way to quickly and neatly plot multifactorial data in lots of meaningful ways.
Some resources:
There is a much better method I recently came across: "trellis plots". The package in R is called lattice.
This is clearly the way to quickly and neatly plot multifactorial data in lots of meaningful ways.
Some resources:
- Excellent Lecture on making trellis plots with lattice (pdf)
- some hype
- The online book on lattice
- code and figures from the book
- ** a table suggesting general forms for each type of plot (thanks Eldon)
install.packages("lattice", dependencies=TRUE) # I don't think there are any dependencies
library("lattice")
Monday, January 4, 2010
pymix compilation errors on Ubuntu
pymix was a little tricky to compile. Here's what I did to get it working.
I downloaded and installed numpy [but that is probably not necessary].
Then I finally had to go into pymix's setup.py and change the location for where it was looking for arrayobject.h:
From:
numpypath = prefix + '/lib/python' +pyvs + '/site-packages/numpy/core/include/numpy' # path to arrayobject.h
To:
numpypath = '/usr/share/pyshared/numpy/core/include/numpy' # path to arrayobject.h
At this point, 'python setup.py build' worked, but the install failed with this error:
byte-compiling /usr/local/lib/python2.6/dist-packages/AminoAcidPropertyPrior.py to AminoAcidPropertyPrior.pyc
SyntaxError: ('invalid syntax', ('/usr/local/lib/python2.6/dist-packages/AminoAcidPropertyPrior.py', 170, 14, ' as = alpha.pop(0)\n'))
turns out that 'as' is a reserved keyword in python 2.6, so you need to go in to that file and change it to something else, like: nada = alpha.pop(0)
I downloaded and installed numpy [but that is probably not necessary].
Then I finally had to go into pymix's setup.py and change the location for where it was looking for arrayobject.h:
From:
numpypath = prefix + '/lib/python' +pyvs + '/site-packages/numpy/core/include/numpy' # path to arrayobject.h
To:
numpypath = '/usr/share/pyshared/numpy/core/include/numpy' # path to arrayobject.h
At this point, 'python setup.py build' worked, but the install failed with this error:
byte-compiling /usr/local/lib/python2.6/dist-packages/AminoAcidPropertyPrior.py to AminoAcidPropertyPrior.pyc
SyntaxError: ('invalid syntax', ('/usr/local/lib/python2.6/dist-packages/AminoAcidPropertyPrior.py', 170, 14, ' as = alpha.pop(0)\n'))
turns out that 'as' is a reserved keyword in python 2.6, so you need to go in to that file and change it to something else, like: nada = alpha.pop(0)
Tuesday, December 15, 2009
Bayesian Optimal Discovery Procedure (BODP) R code
The r code given as an additional file to the paper Bayesian optimal discovery procedure for simultaneous significance testing requires your data to be in matrix form. I spent a day trying to troubleshoot the code when all you need to do is the following:
Open R
Copy and paste the R code from Cao et al.
x<-read.table("x.txt") #your control state
y<-read.table("y.txt") #your test state
x<-as.matrix(x)
y<-as.matrix(y)
BODP(x,y,1000,10) #feel free to change 1000 and 10 to whatever you'd like
Sunday, November 29, 2009
A thread I started a while ago suggests a solution to getting hibernation and suspend working properly with nvidia cards on Inspiron 5160 in Ubuntu. At least as of Karmic Koala (9.10), the solution one-line easier:
In the device section of /etc/X11/xorg.conf add the line:
To /etc/modprobe.d/blacklist.conf add the following:
then reboot
In the device section of /etc/X11/xorg.conf add the line:
Option "NvAGP" "1"To /etc/modprobe.d/blacklist.conf add the following:
blacklist intel_agpthen reboot
slow browsing in firefox in Ubuntu 9.10 Karmic Koala
type in about:config into the browser bar
change the value of the key "network.dns.disableIPv6" from 'false' to 'true'
drastically increased browsing speed for me.
change the value of the key "network.dns.disableIPv6" from 'false' to 'true'
drastically increased browsing speed for me.
Saturday, November 14, 2009
a little Perl spice for ruby
An insightful blog post got me envying some of the brevity of Perl, so I implemented a couple useful idioms from Test::More in Ruby (which is pretty trivial since it allows opening up a class).
We'd like to have a really terse vocabulary when describing the most common test cases:
So, for Bacon at least, this is all that needs to be done (put in your spec_helper.rb file)
The argument against this would go, "well, it's better to be more verbose and understood". The counter-argument something like, "this still makes sense and is way easier to write, so I can write more spec's which == better code".
We'd like to have a really terse vocabulary when describing the most common test cases:
## equality
num = 8
num.should.equal 8 # bacon
num.must_equal 8 # minitest::spec
num.should == 8 # rspec
num.is 8 # clearly superior, similar to Test::More "is a, b"
## true/false
(num == 8).should.be.true # bacon
(num == 8).ok # superior, like Test::more "ok (something)"
So, for Bacon at least, this is all that needs to be done (put in your spec_helper.rb file)
class Object
def is(arg)
should.equal(arg)
end
def ok
should.equal true
end
end
The argument against this would go, "well, it's better to be more verbose and understood". The counter-argument something like, "this still makes sense and is way easier to write, so I can write more spec's which == better code".
Subscribe to:
Posts (Atom)
