January 2, 2009
For keyboard mapping, use KeyTouch which is an excellent program to configure almost any special keyboard including all custom keys on Linux. You can install it by:
apt-get install keytouch
For mapping keys from a remote control (e.g., Pinnacle, in my case), use this excellent tutorial by Christian Weiske. There are some custom scripts towards the end of this article which did not work for me because, apparently, Kaffeine has undergone some changes. However, the following worked for me:
# This maps play/pause to Kaffeine. Just create a shortcut using MenuEditor in KDE.
# It assumes that you have already mapped your custom key using .Xmodmap file. Disable "Enable Launch Feedback" to avoid taskbar windows.
# Place in /usr/bin/ as play_pause (or any other name of your liking)
kaffeine=`dcop | grep kaffeine -c`
if [ $kaffeine = '1' ]
dcop kaffeine KaffeineIface pause
December 11, 2008
Almost all of the material below has been gratefully taken from Charles Lockhart’s page here. I am publishing it here mostly for my own convenience should I use this information later on.
- To create a key:
- To export a public key into file public.key:
gpg --export -a "User Name" > public.key
where -a stands for ASCII output.
To export a private key:
gpg --export-secret-key -a "User Name" > private.key
- To import a public key:
gpg --import public.key
To import a private key:
gpg --allow-secret-key-import --import private.key
- To delete a public key (from your public key ring):
gpg --delete-key UserName
If you have same UserName for multiple keys, then you can issue the following command:
gpg --delete-key HexKeyID
where HexKeyID is the hexadecimal unique ID of any given key. The same hex ID can also be used to export a key.
To delete an private key (a key on your private key ring):
gpg –delete-secret-key User Name
- To list the keys in your public key ring:
To list the keys in your secret key ring:
- To generate a short list of numbers that you can use via an alternative method to verify a public key, use:
gpg --fingerprint > fingerprint
This creates the file fingerprint with your fingerprint info.
- To encrypt data, use:
gpg -e -u SenderUserName -r ReceiverUserName somefile
There are some useful options here, such as -u to specify the secret key to be used, and -r to specify the public key of the recipient.
- To decrypt data, use:
gpg -d mydata.tar.gpg
November 21, 2008
The installation of CVS includes the following:
- The CVS client
- The CVS server (cvsd)
- The optional CVS web interface using CVSWeb
Proceed as follows:
- First install all three of the above
apt-get install cvs cvsd cvsweb
When asked about the location of CVS repository, enter /cvsrepo. This is relative to the cvsd path (/var/lib/cvsd, in Ubuntu) You can later change it in the /etc/cvsd/cvsd.conf file.
- Create the repository folder:
- Change the owner of the repository:
chown -R cvsd:cvsd cvsrepo
- Now initialize the repository. This will be required for all the repository folder that you may later create:
cvs -d /var/lib/cvsd/cvsrepo init
- Now we need to add the user names that will be accessing any given repository:
cvsd-passwd /var/lib/cvsd/cvsrepo +username
If you do not want this user to access the server through the ssh as well, use AllowUsers command in /etc/ssh/sshd_config to allow ssh access to only the allowed users and not for the cvs users.
- We need to make sure that ordinary linux users are now able to access the repository. Edit /var/lib/cvsd/cvsrepo/CVSROOT/config file and have SystemAuto=no.
- To add a project to the CVS repo:
cat >> readme.txt
This is a test project readme.
cvs import -m "Test Project" TestProj TestProj V1
- Now cvsd can be checked using:
cvs -d :pserver:username@localhost:/cvsrepo login
cvs -d :pserver:username@localhost:/cvsrepo checkout TestProj
- To use the web interface of CVSWeb, you need to access (assuming Apache installation, etc. is in place and running) it through http://AddressOfLinuxHost/cgi-bin/cvsweb.
- The icons and css style-sheet for the web interface are copied to /usr/share/cvsweb/. You need to copy them to a place where they are accessible by the apache server (e.g. /var/www/) and update these settings in the /etc/cvsweb/cvsweb.conf file.
- The CVSROOT is visible by default. This can be prevented using “hidecvsroot” => “1” setting in /etc/cvsweb/cvsweb.conf.
- The /etc/cvsweb/cvsweb.conf file also contains settings to select repositories which are to be shown on the web interface.
In writing this post, I have gratefully used the information on the following pages:
November 20, 2008
- First you have to make sure that openssl is installed. Otherwise
apt-get install openssl
- Now we need to create certificates for the webserver:
openssl genrsa -des3 -out server.key 4096
openssl req -new -x509 -days 1500 -key server.key -out server.crt
Fill the values with appropriate information. Remeber the passphrase as we shall need it later in the apache configuration.
- These keys now need to be copied to the apache ssl folder:
cp server.crt /etc/apache2/ssl/ssl.crt/
cp server.key /etc/apache2/ssl/ssl.key/
Delete or secure the original files after copying.
- Now we need to setup apache to use these certificates. Edit /etc/apache2/sites-enabled/ssl and add the following (or as appropriate) at the end of the file:
SSLRandomSeed startup file:/dev/urandom 1024
SSLRandomSeed connect file:/dev/urandom 1024
# The following echoes the passphrase for key file on the server startup
- Now restart the apache:
- Make sure that ssl is present in mods-enabled folder. The file /etc/apache2/mods-enabled/ssl.conf provides some configuration options for ssl module.
- There you go with the ssl enabled in the apache. Do not forget to use https:// to access the secure sites. The /etc/apache2/sites-enabled/ssl file contains other important settings for secure sites on your webserver.
October 26, 2008
This procedure is based on this excellent tutorial on Ubuntu forums by stormbringer.
- First you need to make sure that samba is installed. If not, use the following to install it.
apt-get install samba
This assumes you are logged in as root.
- Now we need to edit the samba configuration file:
In the [global] section, make sure you have the following:
netbios name = HOSTNAME
Here HOSTNAME should be your linux host name.
In the following line, you should give the workgroup of your windows computer:
workgroup = WORKGROUP
And enable the wins support:
wins support = yes
Now create a share called mylinuxshare, e.g., using the following section in smb.conf file:
path = /path/to/linux/sharefolder
browseable = yes
read only = no
guest ok = no
create mask = 0644
directory mask = 0755
force user = USERNAME
where USERNAME must fulfill the following conditions:
- It is registered on both windows and linux machines.
- It has same password on both windows and linux machines.
- It has the desired access to the shared linux folder (/path/to/linux/sharefolder).
Now you should save this file and start samba by:
- The username specified in smb.conf must now be registered and enabled with samba. For this:
smbpasswd -L -a USERNAME
smbpasswd -L -e USERNAME
This sets up the Linux side of the share.
- On windows do the following:
- In the TCP/IP Settings of the active LAN connection, go to advanced tab and in WINS, add the ip address of the linux box.
- Select “Use NetBIOS over TCP/IP”
- Reboot Windows
- In the “Run” textbox, enter
\\ip.address.of.linux.box\MyLinuxShare, and you should see the files shared by the linux machine. You can map it as a network drive in windows as well.
September 27, 2008
To add a new group:
To add user username to this group:
useradd -g groupname username
To add user username with home directory to a group:
useradd -m -g groupname username
To assign bash shell to this newly created user:
usermod -s /bin/bash username
To delete user username:
To delete group groupname:
To change password of a user (you must be logged in as root):
Another better command adduser also creates the home folder automatically (which has to be specified with -m option using useradd):
September 27, 2008
Update your /etc/fstab file in a way similar to:
# /etc/fstab: static file system information.
/dev/sda1 / ext3 defaults,errors=remount-ro,usrquota,grpquota 0 1
/dev/sda5 none swap 0 0
#/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec 0 0
//192.168.2.200/D$ /home/user1/share1 cifs auto,iocharset=utf8,uid=linuxuserid,gid=users,credentials=/somefolder/credentialfile,file_mode=0775,dir_mode=0775 0 0
//192.168.2.100/F$ /home/user1/share2 cifs auto,iocharset=utf8,uid=linuxuserid,gid=users,credentials=/somefolder/credentialfile,file_mode=0775,dir_mode=0775 0 0
where credentialfile should either provide windows username/password through some script or in text, like, e.g.,:
After sharing the given drive/folder on windows, and creating the respective folders in /home/user1, issue the following command to mount these new shares at above-mentioned locations in linux:
Now you should have the windows shares mounted in linux as 755 (or other settings of your choice).
September 25, 2008
If you need a good C++ matrix library for scientific computations, then newmat11 could be your choice. Written by Robert B. Davies, it is a complete matrix library, providing all matrix arithmetic, transpose, inverse, SVD, etc.
You have to compile the library into either a static lib or a dll library. I compiled it with Visual Studio 2003 as a static library and then used some of its functions in a sample project.
To use it as a static library, you need to add the newmat11.lib file to the Visual Studio project and then include the newmat header files in your project.
If you want, you can download this Visual Studio 2003 solution as a starting point. This project links to the static library which can be found in newmat11/Debug folder. There is also a release version, in the Release folder.
September 23, 2008
rundll32.exe powrprof.dll,SetSuspendState Hibernate
September 22, 2008
It is the best calculator I have seen for windows. There are expressions that are a bit complex for standard windows calculator and too simple for a tool like Matlab. Console calculator fills this niche very nicely. Get it here.
Thank you Scott Cogan!