logo

ShrimpWorks

// why am I so n00b?

There’s a strong tendency to want to run everything in Docker these days, especially if you’re trying to run something as an always-on service, since passing --restart=always to your run invocation or Docker Compose configuration ensures that running containers start back up after reboots or failures, and seems to involve a little less “black magic” than actually configuring software to run as services directly on a host.

The downside to this is the approach is that running a service in a container leads to significantly longer startup times, more memory and CPU overhead, lost logs, and in my opinion offer a false sense of security and isolation since most images are still configured to run as root, and more often than not large swathes of the host filesystem are mounted as volumes to achieve simple tasks.

There’s also a belief that your software will magically run anywhere - but if you’re writing Java (or any JVM language) code - that’s one of Java’s biggest selling points - it already has its own VM your code is running in, no most platforms!

Therefore, let’s see how easy it actually is to configure our software to run as a standard system service, providing us with the ability to run it as a separate restricted user, complete with standard logging configuration, and give us control over via standard service myservice start|status|restart|stop commands.

arrow Continue Reading ...

With all the talk of Unreal Tournament 4 possibly being cancelled one of these days, due to Epic’s runaway success with Fortnite, I’ve decided there’s really no reason to not be playing UT99.

Thus, we set about trying to run it on modern hardware, with a modern Linux installation.

As much as this is about setting things up on Linux, it’s also partially my own attempt at some knowledge preservation, as a lot of this stuff ends up being forgotten or lost over time (it’s been almost 20 years! a lot of the old sites and things you expect to find this info on simply do not exist anymore :()

This is part one of two, and will focus on installing and running the game using Wine.

arrow Continue Reading ...

I’ve become fond of using nginx on my development machines, rather than a full Apache.

There are no explicit options built-in which allow something along the same lines as Apache’s userdir, however it’s easy enough to tweak the default configuration to support that behaviour without the need for external modules.

I also do some PHP dabbling from time to time, so need to enable that as well.

Install the required bits:

$ sudo aptitude install nginx php5-fpm

Configure nginx (the below is my customised and cleaned out server definition):

/etc/nginx/sites-available/default

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html index.php;

    server_name _;

    # PHP support in user directories
    location ~ ^/~(.+?)(/.*\.php)$ {
        alias /home/$1/public_html;
        autoindex on;

        include snippets/fastcgi-php.conf;

        try_files $2 = 404;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
    }

    # PHP support in document root
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
    }

    # User directories in /home/user/public_html/
    # are accessed via http://host/~user/
    location ~ ^/~(.+?)(/.*)?$ {
        alias /home/$1/public_html$2;
        autoindex on;
    }
}

I also had to make a change to /etc/nginx/snippets/fastcgi-php.conf, to comment out the following line:

#try_files $fastcgi_script_name =404;

After restarting the nginx service (also make sure the php5-fpm service is running), you will be able to serve HTML and PHP files from your ~/public_html directory.

So, being stuck without access to Photoshop and my regular Windows PC has taught me a little about GIMP – basically it’s exactly the same as Photoshop with a less slick UI :D.

Also, since I haven’t really written anything tutorial-ish in many many years, so this is as much about brushing up on those skills as anything else.

This is a guide for quick and simple photo enhancement using GIMP.

arrow Continue Reading ...

All of my Debian desktop installs running KDE received an update a month or two ago which rendered the “Apper” package management application broken, failing with the following error:

Unable to open database read-only: Database action 'prepare dependency insert 
statement' failed: table dependencies has no column named items_installed

The solution is to delete the Listaller cache DB:

rm -r /var/lib/listaller/db/

The cache will be recreated automatically with the expected structure on the next run of Apper (or other PackageKit type thing).

Ok so this is a little trick I picked up a few years ago when I developed the first version of ECheck and I started learning the POP3 protocol. It’s come in very handy when I’m away from my email client and don’t want to receive email anywhere and fragment my mailbox by spreading it across a few machines.

Firstly, this’ll work on both Linux and Windows systems, with no extra software needed (assuming most Linux distros come with a Telnet client by default).

It’s a pretty useful thing everyone with an email account should know ;-).

Firstly, open a command prompt, and execute the following:

$ telnet <your.mail.server> 110

would obviously be replaced by the address (IP or hostname) of your POP3 server.

If you connect, you should be presented with a welcome message and a “+OK” message. You then enter the following commands to log in, replacing the contents of the "" with your details:

user <your@username>   pass <password>

After which, you should be greeted by another “+OK” assuming you managed to log in. If you make a typo, just send the line with the type

  • you usually cannot backspace and correct mistakes. Issue the correct command again.

Now that you’re in, let’s see your messages. To see how many messages and how big each of your messages is, send the following:

list

Once again a “+OK” line should be shown, followed by a very simple list of message IDs and file sizes (in bytes). Let’s preview a message, shall we?

top <id> <lines>

The headers for message , followed by up to number of lines from the message will be spammed to your console. You can find both the “Subject:” and “From:” header lines to decipher who the message is from and what it’s about. Of course you can also read the body…

Hmm? This message is junk mail or spam? Want to delete it before it hits your inbox?

dele <id>

… will delete the message with ID . It’s important to note that the message IDs are maintained - so if you delete message 1, message 2 will not fall into 1’s place. It’ll remain 2 for the remainder of the session.

If you’ve deleted the wrong message, all it not lost. You can ‘reset’ the mailbox status to how it was when you first connected:

rset

And once you’re done mucking around, disconnect nicely:

quit

It’s also worth noting that the commands are all case-insensitive, though I’m sure the ‘correct’ way of doing it would be to use all caps for commands, the server doesn’t seem to mind either way.

Have fun…

OK so not much is going on… Thought I might as well pass along some general knowledge.

Changing the resolution of a Linux console is a fairly simple task (and requires a reboot) and is generally a nice thing to do if you intend using the console a lot.

Start off by logging in as root, and open your Grub menu file (mine is in /boot/grub/menu.lst). Next, find the option that would normally boot your Linux system (probably looks something like the following):

kernel /vmlinuz-2.6.8-1-386 root=/dev/hda3 ro

Now, simply append to the end “vga=788”, so it ends up looking something like this:

kernel /vmlinuz-2.6.8-1-386 root=/dev/hda3 ro vga=788

The “788” is a code which tells the console to be 800x600 with a 16bit colour depth. Check out a table ot codes for all resolutions and colour depths by clicking the “read more” link below this post.

Save the file, reboot, and enjoy :-).

For reference, here are some VGA codes:

   Colors ( depth) 640x480 800x600 1024x768 1280x1024 1600x1200
   ---------------+-------+-------+--------+---------+---------
   256    ( 8 bit)| 769    771     773      775       796
   32,768 (15 bit)| 784    787     790      793       797
   65,536 (16 bit)| 785    788     791      794       798
   16.8M  (24 bit)| 786    789     792      795       799