Software Projects

Setting up a Static IP Address and Enabling ssh on Ubuntu

Posted in Uncategorized by rmt on June 25, 2011

To use a static IP address, edit /etc/network/interfaces to contain:

# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address <IP address>
netmask <value, which is sometimes 255.255.255.0>
network <value, sometimes same as IP but ending with .0>
broadcast <value, sometimes same as IP but ending with .255>
gateway <value, sometimes same as IP but ending with .254>

# The loopback network interface
auto lo
iface lo inet loopback

To install ssh:

sudo apt-get install openssh-server

This should configure the ssh service to be automatically started during boot.

Advertisements

Arabic glyph support test

Posted in Uncategorized by rmt on June 13, 2011

Full stop: ۔

1536: ؀
1537: ؁
1538: ؂
1539: ؃
1540: ؄
1541: ؅
1542: ؆
1543: ؇
1544: ؈
1545: ؉
1546: ؊
1547: ؋
1548: ،
1549: ؍
1550: ؎
1551: ؏
1552: ؐ
1553: ؑ
1554: ؒ
1555: ؓ
1556: ؔ
1557: ؕ
1558: ؖ
1559: ؗ
1560: ؘ
1561: ؙ
1562: ؚ
1563: ؛
1564: ؜
1565: ؝
1566: ؞
1567: ؟
1568: ؠ
1569: ء
1570: آ
1571: أ
1572: ؤ
1573: إ
1574: ئ
1575: ا
1576: ب
1577: ة
1578: ت
1579: ث
1580: ج
1581: ح
1582: خ
1583: د
1584: ذ
1585: ر
1586: ز
1587: س
1588: ش
1589: ص
1590: ض
1591: ط
1592: ظ
1593: ع
1594: غ
1595: ػ
1596: ؼ
1597: ؽ
1598: ؾ
1599: ؿ
1600: ـ
1601: ف
1602: ق
1603: ك
1604: ل
1605: م
1606: ن
1607: ه
1608: و
1609: ى
1610: ي
1611: ً
1612: ٌ
1613: ٍ
1614: َ
1615: ُ
1616: ِ
1617: ّ
1618: ْ
1619: ٓ
1620: ٔ
1621: ٕ
1622: ٖ
1623: ٗ
1624: ٘
1625: ٙ
1626: ٚ
1627: ٛ
1628: ٜ
1629: ٝ
1630: ٞ
1631: ٟ
1632: ٠
1633: ١
1634: ٢
1635: ٣
1636: ٤
1637: ٥
1638: ٦
1639: ٧
1640: ٨
1641: ٩
1642: ٪
1643: ٫
1644: ٬
1645: ٭
1646: ٮ
1647: ٯ
1648: ٰ
1649: ٱ
1650: ٲ
1651: ٳ
1652: ٴ
1653: ٵ
1654: ٶ
1655: ٷ
1656: ٸ
1657: ٹ
1658: ٺ
1659: ٻ
1660: ټ
1661: ٽ
1662: پ
1663: ٿ
1664: ڀ
1665: ځ
1666: ڂ
1667: ڃ
1668: ڄ
1669: څ
1670: چ
1671: ڇ
1672: ڈ
1673: ډ
1674: ڊ
1675: ڋ
1676: ڌ
1677: ڍ
1678: ڎ
1679: ڏ
1680: ڐ
1681: ڑ
1682: ڒ
1683: ړ
1684: ڔ
1685: ڕ
1686: ږ
1687: ڗ
1688: ژ
1689: ڙ
1690: ښ
1691: ڛ
1692: ڜ
1693: ڝ
1694: ڞ
1695: ڟ
1696: ڠ
1697: ڡ
1698: ڢ
1699: ڣ
1700: ڤ
1701: ڥ
1702: ڦ
1703: ڧ
1704: ڨ
1705: ک
1706: ڪ
1707: ګ
1708: ڬ
1709: ڭ
1710: ڮ
1711: گ
1712: ڰ
1713: ڱ
1714: ڲ
1715: ڳ
1716: ڴ
1717: ڵ
1718: ڶ
1719: ڷ
1720: ڸ
1721: ڹ
1722: ں
1723: ڻ
1724: ڼ
1725: ڽ
1726: ھ
1727: ڿ
1728: ۀ
1729: ہ
1730: ۂ
1731: ۃ
1732: ۄ
1733: ۅ
1734: ۆ
1735: ۇ
1736: ۈ
1737: ۉ
1738: ۊ
1739: ۋ
1740: ی
1741: ۍ
1742: ێ
1743: ۏ
1744: ې
1745: ۑ
1746: ے
1747: ۓ
1748: ۔
1749: ە
1750: ۖ
1751: ۗ
1752: ۘ
1753: ۙ
1754: ۚ
1755: ۛ
1756: ۜ
1757: ۝
1758: ۞
1759: ۟
1760: ۠
1761: ۡ
1762: ۢ
1763: ۣ
1764: ۤ
1765: ۥ
1766: ۦ
1767: ۧ
1768: ۨ
1769: ۩
1770: ۪
1771: ۫
1772: ۬
1773: ۭ
1774: ۮ
1775: ۯ
1776: ۰
1777: ۱
1778: ۲
1779: ۳
1780: ۴
1781: ۵
1782: ۶
1783: ۷
1784: ۸
1785: ۹
1786: ۺ
1787: ۻ
1788: ۼ
1789: ۽
1790: ۾
1791: ۿ

Shell Script Functions for .bashrc

Posted in Uncategorized by rmt on June 2, 2011

These are mostly untested.

# Ensure Unix line endings
function fixlines()
{
/usr/bin/perl -pi~ -e 's/\r\n?/\n/g' "$@" ;
}

# Remove tabs from a file
function fix-tabs() 
{
expand -t 4 "$1" > "$1.expanded"; mv -f "$1.expanded" "$1";
}

# Back up a file with a date-time stamp
function bu()
{
cp $1 ${1}-`date +%Y%m%d%H%M`.backup ;
}

# colored status of running services
function services()
{
printf "$(service --status-all 2>&1|sed -e 's/\[ + \]/\\E\[42m\[ + \]\\E\[0m/g' -e 's/\[ - \]/\\E\[41m\[ - \]\\E\[0m/g' -e 's/\[ ? \]/\\E\[43m\[ ? \]\\E\[0m/g')\n";
}

# Download a web page and show info on what took time
function debug_http()
{
/usr/bin/curl $@ -o /dev/null -w "dns: %{time_namelookup} connect: %{time_connect} pretransfer: %{time_pretransfer} starttransfer: %{time_starttransfer} total: %{time_total}\n" ;
}

# Get just the HTTP headers from a web page (and its redirects)
function http_headers()
{
/usr/bin/curl -I -L $@ ;
}

# Recursively get images from a web page
function http_images()
{
wget -r -l 0 -U Mozilla -t 1 -nd -D $@ -A jpg,jpeg,gif,png "http://$@" -e robots=off
}

# do a svn update and show the log messages since the last update
function svn_uplog() {
  local old_revision=`svn_rev $@`
  local first_update=$((${old_revision} + 1))
  svn up -q $@
  if [ $(svn_rev $@) -gt ${old_revision} ]
  then
    svn log -v -rHEAD:${first_update} $@
  else
    echo "No Changes."
  fi
}

# Concatenate PDF files. Usage: cat_pdfs -o combined.pdf file1.pdf file2.pdf file3.pdf
function cat_pdfs()
{
python '/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py' "$@" ;
}

# myip - finds your current IP if your connected to the internet
function myip()
{
lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | awk '{ print $4 }' | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g'
}

# Google spell checker
function spellcheck()
{
typeset y=$@;curl -sd "<spellrequest><text>$y</text></spellrequest>" https://www.google.com/tbproxy/spell|sed -n '/s="[0-9]"/{s/<[^>]*>/ /g;s/\t/ /g;s/ *\(.*\)/Suggestions: \1\n/g;p}'|tee >(grep -Eq '.*'||echo -e "OK");
}

# Query Wikipedia via console over DNS
function mwiki()
{
blah=`echo $@ | sed -e 's/ /_/g'`; dig +short txt $blah.wp.dg.cx;
}

# view a twitter stream from terminal
function grabtweets()
{
curl -s "twitter.com/$1" | sed -ne '/entry-content/{s/<[^>]*>//g;s/^[ \t]*//;p}';
}

# update twitter via curl as function
function tweet()
{
curl -u "$1" -d status="$2" "http://twitter.com/statuses/update.xml";
}

# Google search
function google()
{
chromium-browser "http://www.google.com/search?&num=100&q=${@}" &
}

# Google text-to-speech in mp3 format
function say()
{
mplayer -user-agent Mozilla "http://translate.google.com/translate_tts?tl=en&q=$(echo $* | sed 's#\ #\+#g')" > /dev/null 2>&1 ;
}

Ubuntu VirtualBox Development Environment Setup

Posted in Uncategorized by rmt on June 2, 2011

To start fresh after encountering problems like bugs in VirtualBox’s snapshots/clones crashing the VM, the following are my notes for installing a clean-slate Ubuntu dev environment on a VirtualBox VM. These instructions work on my computer, and are a work in progress. Some instructions are for Ubuntu 11.04, and some are for Ubuntu 12.04.

Create new VM

Start VM and Install Ubuntu from ISO. Choose Download updates while installing. If computer name causes a problem, do Back then Forward, and the problem should disappear. Name=first name, Login=last name.

When prompted to restart, do Devices->CD/DVD Drive->Eject disk from virtual drive, and shut down VM

Configure VM Settings and Host/Guest Shared Folders:

Settings: System->Processor->8 CPUs
System->Acceleration->Enable VT-x
Display->Video Memory: Increase to max
Display->Video: Enable 3D Acceleration
USB->USB Device Filters->Add and choose handset hardware that’s connected to USB
USB->USB Device Filters->Add Empty Filter
Shared Folders: Add Folder Path to C:\eclipse-workspace on host
Check the checkbox for Auto-mount (Folder will be automatically mounted as /media/sf_eclipse-workspace on the Ubuntu guest system owned by root, and is mountable using mkdir ~/eclipse-workspace;sudo mount.vboxsf -o fmode=0777,dmode=0777 eclipse-workspace /home/username/eclipse-workspace/)
[Modification: don’t choose Auto Mount, just choose Make Permanent, and mount by doing the edit listed below to /etc/rc.local.]

Start VM
(Note message saying “It seems that you do not have the hardware required to run Unity…”)

Switch to Gnome classic desktop
Disable the screen saver and screen lock, and power management in System->Preferences->Screensaver or do


gsettings set org.gnome.desktop.screensaver idle-activation-enabled false
gsettings set org.gnome.desktop.screensaver lock-enabled false

Disable startup sound in System->Preferences->Startup Applications Preferences->GNOME Login Sound
Disable login sound in System->Administration->Login Screen, and choose “Ubuntu Classic” as window manager
Install updates in Update Manager
Restart Ubuntu

Ensure packages are updated:

sudo apt-get update
sudo apt-get upgrade

Do Devices->Install Guest Additions for copy/paste support. Ignore the message saying “the headers for the current running kernel were not found.”

Install packages:

sudo apt-get install vim chromium-browser eclipse-platform libarchive-zip-perl libtext-csv-xs-perl libxml-simple-perl git-core subversion mercurial ia32-libs conky-all proguard gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z1-dev libgl1-mesa-dev libarchive-zip-perl libfile-find-rule-perl subversion build-essential g++ pkg-config gawk libxml2 libxml2-dev libxml2-utils xsltproc flex automake autoconf libtool libpcre3-dev maven2

Set Nautilus preferences: List view
Set Terminal preferences: Scrolling->Unlimited, Use custom default terminal size: 120 columns, 60 rows
Add the Eclipse and Chromium launchers to the panel
Set up Chrome preferences/sync/authentication, Firefox preferences
Restart Ubuntu

Install Android SDK: http://developer.android.com/sdk

Restart Ubuntu

Install Android ADT Plugin for Eclipse:
Put https://dl-ssl.google.com/android/eclipse/ in Eclipse->Help->Install New Software…
If this step fails with “There are no categorized items” or “There are no items available,” re-run as “eclipse -clean” and try this step again

Set location of Android SDK in Eclipse Window->Preferences->Android->SDK Location

Restart Ubuntu

Start Android SDK and AVD Manager and install all packages (except Real3D by LG, because its download speed is slow)

Install Android NDK http://developer.android.com/sdk/ndk/index.html

Install Subclipse: Eclipse->Help->Install New Software->http://subclipse.tigris.org/update_1.6.x

Install EGit: Eclipse->Help->Eclipse Marketplace->egit

Edit ~/.ssh/config (and add keystore as a read-only shared folder):
Host github.com
IdentityFile ~/keystore/github-id_rsa

Set up git:
git config --global user.name "Your Name"
git config --global user.email you@example.com

Install vim-instant-markdown:
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
sudo gem install redcarpet pygments.rb
sudo npm -g install instant-markdown-d

Add to ~/.bashrc:

PATH=$PATH:/home/$USER/android-sdk-linux_x86/tools
PATH=$PATH:/home/$USER/android-sdk-linux_x86/platform-tools
PATH=$PATH:/home/$USER/android-ndk-rXX [where XX is 5c, for example]
export PATH

Add shared folder mount to /etc/rc.local:
sudo mount.vboxsf -o fmode=0777,dmode=0777 eclipse-workspace /home/username/eclipse-workspace/

Configure to log in automatically in System->Administration->Login Screen Settings

Test: Set handset to “PC Mode” and do “adb devices” to check if attached

Add conky to System->Preferences->Startup Applications

Configure conky system monitor panel

Save the following lines as ~/.conkyrc:

background yes
use_xft yes
xftfont 123:size=8
xftalpha 0.1
update_interval 0.5
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent no
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 250 5
maximum_width 400
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_shade_color red
default_outline_color green
alignment top_left
gap_x 10
gap_y 10
no_buffers no
uppercase no
cpu_avg_samples 2
net_avg_samples 1
override_utf8_locale yes
use_spacer yes
text_buffer_size 256

TEXT

${voffset -10}
${color DimGray}
${font}
${font Arial:bold:size=10}${color Tan1}SYSTEM ${color DarkSlateGray} ${hr 2}
$font${color DimGray}$sysname $kernel $alignr $machine
Intel Pentium D $alignr${freq_g cpu0}Ghz
Uptime $alignr${uptime}
File System $alignr${fs_type}

${font Arial:bold:size=10}${color Tan1}PROCESSORS ${color DarkSlateGray}${hr 2}
$font${color DimGray}Core 1 ${cpu cpu1}% ${cpubar cpu1}
Core 2 ${cpu cpu2}% ${cpubar cpu2}
Core 3 ${cpu cpu3}% ${cpubar cpu3}
Core 4 ${cpu cpu4}% ${cpubar cpu4}

${font Arial:bold:size=10}${color Tan1}MEMORY ${color DarkSlateGray}${hr 2}
$font${color DimGray}MEM $alignc $mem / $memmax $alignr $memperc%
$membar

${font Arial:bold:size=10}${color Tan1}HDD ${color DarkSlateGray}${hr 2}
$font${color DimGray}/home $alignc ${fs_used /home} / ${fs_size /home} $alignr ${fs_free_perc /home}%
${fs_bar /home}
/disk $alignc ${fs_used /media/disk} / ${fs_size /media/disk} $alignr ${fs_free_perc /media/disk}%
${fs_bar /media/disk}
/disk-1 $alignc ${fs_used /media/disk-1} / ${fs_size /media/disk-1} $alignr ${fs_free_perc /media/disk-1}%
${fs_bar /media/disk-1}

${font Arial:bold:size=10}${color Tan1}TOP PROCESSES ${color DarkSlateGray}${hr 2}
${color DimGray}$font${top_mem name 2}${alignr}${top mem 2} %
$font${top_mem name 3}${alignr}${top mem 3} %
$font${top_mem name 4}${alignr}${top mem 4} %
$font${top_mem name 5}${alignr}${top mem 5} %

${font Arial:bold:size=10}${color Tan2}NETWORK ${color DarkSlateGray}${hr 2}
$font${color DimGray}IP on eth0 $alignr ${addr eth0}

Down $alignr ${downspeed eth0} kb/s
Up $alignr ${upspeed eth0} kb/s

Downloaded: $alignr ${totaldown eth0}
Uploaded: $alignr ${totalup eth0}

Add .vimrc: https://gist.github.com/rmtheis/5be3ba27ae42fcc63e1f

Install Oracle JDK 7:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Perl subroutine for building a GFF3-formatted key-value pair string

Posted in Uncategorized by rmt on April 23, 2011

This Perl subroutine creates strings for writing to the ninth column (the “attributes” column) of a GFF format file.

Start with a hash of the keys/values you want to add to the GFF3 attributes column. When calling the subroutine, pass it a reference to your hash like this:

my $attribs = &stringconcat(\%keyvalue);

The hash indices and hash values will respectively become the tags and values in the returned string.

# Forms a concatenated string of key/value pairs given a reference to
# a hash of key/value pairs.
#
# Return value:
#  A string with the key/value pairs concatenated with '=' and ';',
#  for example, "key1=value1;key2=value2;key3=value3" and with
#  the "Name" and "ID" key/value pairs at the beginning as required by
#  Apollo.
#
sub stringconcat {
  my(%keyvalue) = %{$_[0]};

  # Put the "ID" and "Name" fields at the beginning
  my $attribs = "";
  if (exists $keyvalue{'ID'}) {
    $attribs .= "ID=$keyvalue{'ID'}";
  }
  if (exists $keyvalue{'Name'}) {
    if (exists $keyvalue{'ID'}) {
      $attribs .= "\;";
    }
    $attribs .= "Name=$keyvalue{'Name'}";
  }

  # Form a string from the remaining key/value pairs
  foreach my $key (keys %keyvalue) {
    if ($key eq "Name" || $key eq "ID") {
      next;
    }
    $attribs .= "\;$key=$keyvalue{$key}";
    print "$key=$keyvalue{$key}\n" if DEBUG;
  }
  print "\n" if DEBUG;
  return $attribs;
}

Using this code snippet puts the “Name” and “ID” attributes first in the list, which seems to be required by Apollo in order to open the GFF file at all.

Cloning a VirtualBox Virtual Machine

Posted in Uncategorized by rmt on April 12, 2011

(Adapted from http://srackham.wordpress.com/cloning-and-copying-virtualbox-virtual-machines/)


cd "C:\Users\Username\VirtualBox VMs\Gentoo32-1"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonehd Gentoo32-1.vdi "Gentoo32-1 clone.vdi"

Excel VBScript Arithmetic Rounding Function

Posted in Uncategorized by rmt on March 30, 2011

From http://support.microsoft.com/kb/196652.

' Asymmetric arithmetic rounding - rounds .5 up always.
Function AsymArith(ByVal X As Double, _
    Optional ByVal Factor As Double = 1) As Double
    End Function
    AsymArith = Int(X * Factor + 0.5) / Factor
End Function

Gentoo x86 Linux Installation on a VirtualBox Image

Posted in Uncategorized by rmt on March 14, 2011

UPDATE: gentoo.org now has a one-page “quick install guide” that covers the Gentoo installation.
(Adapted from: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml. This is a work in progress.)

Download VirtualBox. Get the appropriate version–your computer’s current operating system is the host OS for Virtualbox.

http://www.virtualbox.org/wiki/Downloads

Download the ISO minimal installer for Gentoo x86 from this directory, getting the file install-x86-minimal-xxxxxxxx.iso:

http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/releases/x86/current-iso/

Start the Virtualbox image, and select the ISO file as the installation media

Set up networking, choosing wired or wireless according to on your own computer’s network setup:

net-setup eth0

Test networking:

ping http://www.google.com

Create the boot partition:

fdisk /dev/sda
n
p
1
Enter
+32M
p

Create the swap partition:

n
p
2
Enter
+512M
t
2
82
p

Create the root partition:

n
p
3
Enter
Enter
p
w

Apply the ext2 filesystem to the boot partition:

mke2fs /dev/sda1

Apply the ext3 filesystem to the root partition:

mke2fs -j /dev/sda3

Create a swap signature and activate the swap partition:

mkswap /dev/sda2
swapon /dev/sda2

Mount the partitions:

mount /dev/sda3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot

Check the date:

date

Download and unpack the latest stage 3 tarball at the Gentoo mountpoint, getting the file stage3-i686-xxxxxxxx.tar.bz2:

cd /mnt/gentoo
links http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/releases/x86/autobuilds/current-stage3-i686/
tar xvjpf stage3-*.tar.bz2

Download portage from a mirror and install:

wget http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/snapshots/portage-latest.tar.bz2
tar xvjf portage-latest.tar.bz2 -C /mnt/gentoo/usr

Don’t reconfigure any compile options

Choose a mirror for Gentoo base system installation

mirrorselect -i -o >> /mnt/gentoo/etc/make.conf

Copy DNS config

cp -L /etc/resolv.conf /mnt/gentoo/etc/

Mount filesystems for installation:

mount -t proc none /mnt/gentoo/proc
mount --rbind /dev /mnt/gentoo/dev

Change from installation CD to installation system

chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile
export PS1="(chroot) $PS1"

Update system

emerge --sync

Choose the eselect profile for “desktop/gnome”:

eselect profile list
eselect profile set 3

Update make.conf:

nano -w /etc/make.conf

Change variables in make.conf:

USE="firefox gnome gtk icu kdrive python sqlite -qt4 threads"

Set your locale by uncommenting the two en_US entries and doing locale-gen

nano -w /etc/locale.gen
locale-gen

Set the time zone

cp /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

Install a kernel source

emerge gentoo-sources

Automatically configure and compile kernel source

emerge genkernel
zcat /proc/config.gz > /usr/share/genkernel/arch/x86/kernel-config
genkernel all

Wait

Don’t auto-load any kernel modules

Configure filesystem information

nano -w /etc/fstab

Insert these lines into fstab:

/dev/sda1   /boot        ext2    defaults,noatime     1 2
/dev/sda2   none         swap    sw                   0 0
/dev/sda3   /            ext3    noatime              0 1
/dev/cdrom  /mnt/cdrom   auto    noauto,user          0 0

proc        /proc        proc    defaults             0 0
shm         /dev/shm     tmpfs   nodev,nosuid,noexec  0 0

Set computer name

nano -w /etc/conf.d/hostname

Insert:

HOSTNAME="mycomputername"

Set the domain and DHCP:

nano -w /etc/conf.d/net

Insert:

nic_domain_lo="my-nisdomain"
config_eth0=( "dhcp" )

Set to automatically start networking at boot

ln -s /etc/init.d/net.lo /etc/init.d/net.eth0

rc-update add net.eth0 default

Set up the hosts file

nano -w /etc/hosts

Insert:

127.0.0.1	mycomputername.my-nisdomain mycomputername localhost

Set the root password

passwd

Don’t edit /etc/rc.conf
Don’t edit /etc/conf.d/keymaps

Set clock options (set CLOCK to “UTC” for dual boot with Windows, non-Virtualbox)

nano -w /etc/conf.d/hwclock

Put:

CLOCK="local"
TIMEZONE="America/Los_Angeles"

Install system logger

emerge syslog-ng

Wait

Add system logger to update list:

rc-update add syslog-ng default

Install cron daemon

emerge vixie-cron
rc-update add vixie-cron default

Install file indexing

emerge mlocate

Install DHCP client

emerge dhcpcd

Install bootloader and configure

emerge grub
nano -w /boot/grub/grub.conf

Put:

default 0
timeout 30
splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title Gentoo Linux 2.6.36-r5
root (hd0,0)
kernel /boot/kernel-genkernel-x86-2.6.36-gentoo-r5 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/sda3
initrd /boot/initramfs-genkernel-x86-2.6.36-gentoo-r5

## Only in case you want to dual-boot
#title Windows XP
#rootnoverify (hd0,5)
#makeactive
#chainloader +1

grep -v rootfs /proc/mounts > /etc/mtab
grub-install --no-floppy /dev/sda

Unmount the partitions:

exit
cd
umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo

Shut down the system:

shutdown -h now

On VirtualBox, remove the installation disk from virtual drive, or change the boot order so you don’t boot from the installation CD.

Add a user: restart the VirtualBox image, log in as root and do:

useradd -m -G users,wheel,audio -s /bin/bash newusername
passwd newusername

Update applications and dependencies

emerge --sync

Remove stage 3 tarball and Portage snapshot

rm /stage3-*.tar.bz2*
rm /portage-latest.tar.bz2*

Install vi:

emerge vim

Update make.conf:

nano -w /etc/make.conf

Set variables in make.conf:

USE="firefox gnome gtk icu kdrive python sqlite -qt4 threads"

VIDEO_CARDS="nvidia"

Attempt to add video drivers:

emerge --config nvidia-drivers

Install VirtualBox Guest Additions:

emerge virtualbox-guest-additions

Install GNOME:

emerge gnome

Wait

Configure settings for GNOME:

/etc/init.d/dbus start

rc-update add dbus default

echo "exec gnome-session" > ~/.xinitrc

sed -i '1i\export XDG_MENU_PREFIX=gnome-' ~/.xinitrc

startx

Exit GDM

rc-update add xdm default

Add to /etc/conf.d/xdm:

DISPLAYMANAGER="gdm"

Install Chromium:

export ACCEPT_KEYWORDS="~x86"

emerge -av www-client/chromium

Reboot

reboot

Clone the VirtualBox VM for backup purposes.

Font Support Test

Posted in Uncategorized by rmt on March 13, 2011

CLDR Charts

Albanian: a e kupton këtë gjuhë?
Amharic: ቁም፡ወይንም፡ተኩሳለሁ
Azeri: Siz bu dili başa düşürsünüz? Dirək Ə
Baluchi: بوشت اگہ نوشتیں من ترا شوٹ کنی
Bengali: আপনি এই ভাষা বোঝেন কি?
Bosnian: Razumijete li ovaj jezik?
Bulgarian: Здравейте
Burmese: ဘယ်သူ့မှ မြန်မာစကားပြောတတ်တဲ့သူ မရှိဘူး
Cantonese: 你明唔明白呢种语言呀?
Cebuano: Makasabot ka ba aning sinultian?
Chavacano: Ya entende ba tu este lenguaje?
Croatian: Razumijete li ovaj jezik? đ
Dari: آیا این زبان را می فهمی؟
Egyptian: قَف والا حأضرب بالنار
Emirati: إنت تفتهم هاللغة؟
French: Comprenez-vous cette langue?
Gan: 你懂这种语言吗?
Georgian: ინგლისური იცით?
Gujarati: અમારે યંત્રમાં ખરાબી છે
Haitian: Depoze zam ou atè
Hausa: Kana jin wannan harshen? Ɗaya
Hebrew: אנחנו כאן בשבל לעזור לך
Hindi: क्या तुम्हें यह भाषा समझ आती है?
Ilocano: Maawatam kadi daytoy nga pagsasao?
Indonesian-Bahasa: apa anda mengerti bahasa ini?
Iraqi: إنت تفتهم هاللغة؟
Japanese: 何がありましたか?
Javanese: Punapa penjenengan ngeRtos basa punika?
Kashmiri: ۔ ?ہاو میہ پنُنن شناختی کاڑ۔ ہاو میہ پنُنن شناختی کا۔-
Kazakh: Сіз мына тілді түсінесіз бе?
Khmer: ស្រីស្អាតនោះ
Korean: 비행중 비상사태가 발생했다.
Kurmanji: تۆ ڤێ زمانی تێدگه‌هێ؟
Libyan: عندنا حالة طارئة في الرحلة
Lingala: Ozali koyoka monoko oyo?
Malay: aandaa faahaam baahaasaa inee?
Mandarin: 船长在哪儿?
Mongolian: Би Монголоор ярьдаггүй.
Moroccan: واش تتكلم هاد اللغة؟
Nepali: के तपाई यो भाषा बुझ्नु हुन्छ?
Pashto-Afghanistan: ته په دغه ژبه باندې پوهیږی؟
Pashto-Pakistan: تاسو په دې ژبه پوهيږی؟
Persian-Farsi: اين زبونو می فهمی؟
Polish: Czy rozumiecie ten język?
Portuguese: Você entende português?
Punjabi-India: ਅਪਣਾ ਹਥਿਆਰ ਹੇਠਾਂ ਰੱਖੋ
Punjabi-Pakistan: ਉੜਾਨ ਵਿਚ ਸੰਕਟਕਾਲ ਹੈ
Romanian: Mulţumesc.
Russian: Вы понимаете этот язык?
Saudi: لو سمحت انتظر حتى يجي المترجم
Serbian: Да ли разумете овај језик?
Sindhi: اسانجي حڪمن جي پيروي ڪر
Somali: xabad ha ridin
Sorani: ئه‌م زمانه‌ تێ ئه‌گه‌ی؟
Spanish: Tenemos una anomalía.
Sudanese: جمهورية السودان
Swahili: unaelewa lugha hii?
Syrian: عندنا تقصير بالشغل
Tagalog: Naiintindihan po ba ninyo ang wikang ito?
Tamashek: Əttarrăɣ dăɣ-ik.
Tamil: உங்களை சந்தி த்ததில் மக ிழ்ச்சி .
Tausug: Kahatihan mu in bahasa ini?
Telugu: మీకు ఈ భాష అర్థమౌతు౦దా ?
Thai: คุณเข้าใจภาษานื้ไหม
Tigrinya: ነዚ ቋንቋዚ ትርድኦዶ?
Tunisian: تفهم اللغة هَذِي؟
Turkish: Burada hiç kimse Türkçe bilmiyor
Turkmen: Şu dile düşünýäňizmi?
Uighur: ئېنگىلىسچە سۆزلەمسىز؟
Urdu: کیا آپ یہ زبان سمجھتے ھیں؟ – چاۓ
Uzbek: Bizda havoda favqulodda hodisa sodir boldi
Vietnamese: Bỏ vũ khí xuống
Wu: 这种语言侬懂伐?
Yakan: Ga’ misan dembuwa’ mekejari megbissa Yakan
Yemeni: بتفهم؟
Yoruba: Şe o gbọ́ èdè yí?

VMD Tcl Scripts

Posted in Uncategorized by rmt on March 9, 2011

The following are some small Tcl scripts for VMD. These scripts demo some graphics and show the conformational change in hemoglobin when the heme is bound. The scripting syntax for VMD is poorly documented, so these scripts may be of use to people trying to get their scripts working.

Start VMD and do Extensions->Tk Console

In the console, CD to the working folder

Open Graphics->Representations to show graphics info

source 1.tcl

source 2.tcl

source 3.tcl

source 4.tcl

1.tcl

display resetview
display update on
display update ui
mol load pdb 1GZX.pdb
mol modstyle 0 0 NewCartoon
mol modcolor 0 0 Chain

2.tcl

mol selection heme
mol addrep 0
mol modstyle 1 0 licorice
mol modcolor 1 0 element

3.tcl

mol selection "oxygen within 4 of heme"
mol addrep 0
mol showrep 0 0 off
mol modstyle 2 0 VDW
mol modcolor 2 0 element

4.tcl

mol showrep 0 2 off
mol showrep 0 0 on
display resetview
mol selection polar
mol addrep 0
mol modstyle 3 0 dotted
mol modcolor 3 0 conformation
1GZX.pdb
1a3n-aligned.pdb