Skip navigation.

Mr Green's Coffeshop

Heal the world, smoke weed!

Free poker clock which runs under Linux.

, , ,

If you play a lot of live poker like me you can use Simple Tournament Director to keep track of blinds and levels in the tournament. It's similar to The Tournament Director except that it's completely free, runs under both Windows and Linux and it's really fast to configure! You'll have your tournament running in 1 minute.

It offers you the basic functionallity you need in a home game. You can adjust leveltimes, blinds and antes, and you can save your tournament setups to disk. It also has support for "speaking" the blinds.

Open torrent files from browser with uTorrent.

http://www.ubuntuforums.org/showpost.php?p=1421017&postcount=11

From the post:

Yes, it is possible launch the torrent automatically. You need a special script.

Steps to get it:
1. Open a terminal
2. Type
Code:

sudo gedit /usr/bin/utorrent


3. Paste the following text
Code:

#!/bin/sh

cd ~/.wine/drive_c/Program\ Files/utorrent
if [ "$1" != "" ]; then
var="`echo $1 | sed 's/\//\\\/g'`"
var="Z:${var}"
wine utorrent.exe "$var"
else
wine utorrent.exe
fi


Modify the path to the utorrent directory where needed
4. Save and close Gedit
5. Type
Code:

sudo chmod a+x /usr/bin/utorrent


You can now launch utorrent from anywhere by typing 'utorrent' (no .exe)
To open .torrents automatically from firefox set the utorrent file as the default program.



Ofcourse it also works with Opera.

How to unsecure Samba

This is not the proper way to do things from a security perspective but IT WORKS!!!

In Gnome under Ubuntu there is a menuchoice:
System -> Administration -> Shared Folders

This let's you set up shared folders via Samba, but it will never let you access those folders from another computer, thus making it totally useless.

When a windows user selects a folder for sharing that folder is accessible to all users on the network, and that is probably how you'd expect it to work if you try to do the same thing under Linux. That's just not the case. You may share folders till your eyes pops out, but that is all that is going to happen. All this security is probably a good thing in a corporate network, but on a home-network, protected by a firewall, it's just one big hassle.



Turning off Samba authentication

In order to make those folders you share with the Gnome front-end samba app you need to unsecure Samba a bit. It is just a tiny line you need to add to your smb.conf file:
Change
;security=user
to
security=share

This says to samba that users connecting through Samba don't need an account on the linux machine. Now if you create a shared folder, remote users can access it as long as they can connect to the linux machine and the permissions for that folder allows "other" to read and write. By setting security = share you avoid the following steps for each new sambauser:
sudo useradd newsambauser
sudo passwd newsambauser
 enter system account password
 enter system account password
sudo smbpasswd -a newsambauser
 enter samba password
 enter samba password
sudo /etc/init.d/samba restart



Security the easy way

If you worry about security, you can specify the ip-adresses that are allowed to access via Samba to allow only IP adresses on your local network. On my network every computer gets an IP between 10.0.0.2 and 10.0.0.255 so inserting the following line in the global section of smb.conf will make sure only computers on my network will have access to samba:
hosts allow = 10.0.0.



Proper permissions for existing files and directories

As stated above the permissions for the existing files and directories you share must be correct. They must be readable and writable by everyone. Use this command to allow "other" and "group" read and write permission:
sudo chmod -R 777 /home/share

This will recursively give all files and folders below /home/share, including the share folder read/write permissions.



Proper permissions for new files and directories

When you add a new folder or a file to your new share you'd want everybody to automatically have read/write permissions to it. This is accomplished by specifying the "create mask" and
"directory mask" properties in smb.conf like shown below:

[global]
security = share

[public]
   comment = Public Folder
   path = /home/share
   public = yes
   writable = yes
   create mask = 0777 ///// New files are created with rwxrwxrwx permissions.
   directory mask = 0777 // New directories are created with rwxrwxrwx permissions.

Windows reinstall messes up grub.

,

Last night I reinstalled Windows to make it a mean, lean gaming machine. And that's what it looks like it's gonna be. A major advantage with using Linux for all your non-gaming needs is that you don't need to install all sorts of crap on your Wintendo partition. That's something to think about for you die hard gamers. Reboot in thirty seconds is a nice thing!

The only thing installed on my Wintendo now is drivers for the Radeon x800 Pro card and the Soundblaster Live soundcard. I also installed the latest version of DirectX and the game I'll be playing 98% of the time; Counter Strike:Source and Steam. Now all I need to do to is tweak Windows a bit.

Of course the Windows installation messed up the grub bootloader and now I can't access my precious Ubuntu Linux. Now I need a way of getting GRUB back, as I do not plan to use Windows until Dapper is released and I'm not about to reinstall Ubuntu.

There is a howto at the wiki so I'll check out that when I get home from work.

Recovering Ubuntu after installing Windows


PS! As opposed to installing Ubuntu, where all the hardware works out of the box, Windows did not have drivers for the Soundblaster Live 5.1 soundcard :D

A word of advice:

Do not use the Super Grub Disk as it doesn't work, at least it did not work for me.

When using the Live CD approach, DO NOT setup grub on (hd0,1) or whatever is behind the comma for you. USE "setup (hdo)" instead.

This will reinstall grub on your MBR which is what you want, I tried the hd0,1 approach first with no luck and that made sure that the linux OS could not be booted when running setup (hd0) afterwards. I guess it installed the grub boot files where the linux kernel were supposed to boot from.


So to sum it all up, this is what I do(Overwrites MBR):

Boot the livecd.
Start a terminal.

sudo -i
grub
find /boot/grub/stage1 // Will print something like (hd0,1)
root (hd0,1)
setup (hd0)
quit



Reboot computer.

Now your old grub menu should be there.

File permissions

There is a great article regarding file permissions at Linux Forums:
http://www.linuxforums.org/security/file_permissions.html

Java Web Start

,

Java Web Start allows you to launch a Java application by clicking on a web page link. The application is cached locally and every time the application runs, Java Web Start checks if there is a newer version on the server, and if so the new version is downloaded.

I decided to test it out with a small test application that just shows an empty JFrame, JWSTest.java:
package jwstest;
import javax.swing.JFrame;
public class JWSTest {
    public static void main(String[] args)
    {
        JFrame f = new JFrame();
        f.setSize(100, 100);
        f.setTitle("TestFrame");
        f.setVisible(true);
    }
}


Netbeans creates the Jar file for me so I won't go through that.


Place the Jar file on your web server and create JWSTest.jnlp file in the same location:
<?xml version="1.0" encoding="utf-8"?>
        <jnlp spec="1.0"
                codebase="http://my.opera.com/Mr%20Green/homes/dist"
                href="JWSTest.jnlp">
        <information>
                <title>TestFrame Demo</title>
                <vendor>GreenSoft AS</vendor>
                <offline-allowed/>
        </information>
        <resources>
                <jar href="JWSTest.jar"/>
                <j2se version="1.3+"
                href="http://java.sun.com/products/autodl/j2se"/>
        </resources>
        <application-desc main-class="jwstest.JWSTest"/>
</jnlp>


Now you can direct Opera to http://my.opera.com/Mr%20Green/homes/dist/JWSTest.jnlp to launch the application. This runs in the sandbox so you don't need to fear havoc by clicking the link. You need Java installed.

Netbeans / Matisse layout manager

Now if you try to do the same with a jar file from an existing project created in Netbeans, and try to run it via JWS it just refuses to load. It seems like the application starts but never gets displayed, the javaw process is running but no application is visible.

This has to do with the swing-layout-1.0.jar file used when building GUI's with Matisse/Netbeans. I must be included as a reference in the jnlp file and placed on the server or the application never shows.

For more information on Netbeans/JWS look below.

To enable Java Web Start for Netbeans applications go here:
http://www.netbeans.org/kb/articles/matisse-jaws.html


Security / All permissions

By default, applications launched via JWS runs in a sandbox environment, just lika an Applet would. As an example you won't be able to write to the file-system or create connections to hosts other than the one where the application came from. If you want your app to have the same permissions as a "native/local" java application all the JAR files in the application needs to be signed. Even the swing-layout-1.0.jar file and other third party libraries must be signed. See my previous post on "Signing jar files"

After signing the Jar files you have to insert the following into the jnlp file to actually get all permissions:
<security>
 <all-permissions/>
</security>


If the following dialog box appears you've successfully signed your application:


The warning says the certificate is invalid since it is not from a Certificate Authority. Since that costs money I won't bother with that.



One issue that I haven't figured out yet is why the javaw process never ends. After shutting down an application started with Java Web Start, the javaw process is still running. If you start the same application 10 times there will be 10 javaw processes running after they have all been closed/exited.

Signing JAR files.

, ,

In order to get access to the filesystem all jar files in an application must be signed if it is started via Java Web Start or if it is an Applet.

First step is generating a keypair with the keytool.

/usr/lib/j2sdk1.5-sun/bin/keytool -genkey -alias green -keypass greenpass


green is the alias for the keypair, and greenpass is the password to access that alias(or keypair). The keypair will be stored in the file .keystore in your homedirectory unless you specify otherwise.

You'll be asked a lot of questions, you may lie or just hit enter!

Create a self-signed certificate:
/usr/lib/j2sdk1.5-sun/bin/keytool -selfcert -alias green



After the keypair has been genereated the jar file can be signed with jarsigner:

In it's easiest form, jarsigner's syntax:
jarsigner jarfile alias

/usr/lib/j2sdk1.5-sun/bin/jarsigner JWSTest.jar green


It will ask for both passwords specified while generating the keys.

The jar file has now been signed ;)

New harddisk.

Added a new harddisk to my ubuntu installation last night. Actually the harddisk was NTFS and belonged to windows. Without the ability to write to NTFS partitions in Linux I had to move it over.

After a lot of burning to clear the disk of data I did the following to get it under ubuntu's control.

sudo fdisk /dev/hdb


d (Delete the existing windows partition.)
n (Create a new primary partition, for the entire disk.)
w (Write table to disk and exit.)

To format the disk I used the following command:
sudo mkfs.ext3 /dev/hdb1


When this completed all I needed to do was to mount the new drive somewhere so I added the following line to /etc/fstab:
/dev/hdb1     /home/rjs    ext3    defaults   1   1


To actually get the disk mounted according to fstab I just typed:
sudo mount -a 


So now I have 200 extra gigabytes of free space to fill up, I think Azureus will overheat tonight.
December 2009
M T W T F S S
November 2009January 2010
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31