sakana

very short memo

filter packet based upon URI

Wireshark is your good friend. You can find fun time of examining packets with wireshark.

Sometimes you would like to filter packets and extract packets only for specific URL, say, “www.google.com”. Wireshark provides content filter for HTTP as well.

Specify filter as follows.

http contains "www.google.com"

filter manual will help you guide through details of filter configuration.

automatic yum update

Sometime you would like to configure Scientific Linux to update packages automatically without manual intervention. You can configure system as you wish and here is a short memo to achieve such.

yum-cron

You can configure cron to start yum command on daily basis to check for update. First install yum-cron command.

$ sudo yum install yum-cron

Installation will place 0yum.cron file under /etc/cron.daily directory. And cron executes yum-cron on daily basis.

You can control yum-cron’s behavior by modifying configuration file, /etc/sysconfig/yum-cron. I hereby quote some parameters in which you may be interested.

# Don't install, just check (valid: yes|no)
CHECK_ONLY=no

# Don't install, just check and download (valid: yes|no)
DOWNLOAD_ONLY=no

And start service for now. And configure system to start yum-cron service upon restart.

$ /etc/init.d/yum-cron start
$ sudo chkconfig yum-cron on

history

You can check if cron has started or not by referencing /var/log/cron* logs.

Aug 26 03:16:01 <hostname> run-parts(/etc/cron.daily)[24221]: starting 0yum.cron
Aug 26 04:07:46 <hostname> run-parts(/etc/cron.daily)[24421]: finished 0yum.cron

Log message are yielded in /var/log/yum.log file

Aug 09 04:09:11 Updated: nss-softokn-devel-3.14.3-3.el6_4.i686
Aug 09 04:09:12 Updated: nss-devel-3.14.3-4.el6_4.i686
Aug 09 04:09:13 Updated: nss-tools-3.14.3-4.el6_4.i686
Aug 14 03:36:46 Updated: httpd-tools-2.2.15-29.sl6.i686
Aug 14 03:36:48 Updated: httpd-2.2.15-29.sl6.i686

as specified in yum’s configuration file, /etc/yum.conf.

[main]
debuglevel=2
logfile=/var/log/yum.log

Or you can check history by yum history command.

$ sudo yum history
Loaded plugins: auto-update-debuginfo, downloadonly, fastestmirror, refresh-packagekit, security
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
   138 | root <root>              | 2013-08-14 03:36 | Update         |    2
   137 | root <root>              | 2013-08-09 04:09 | Update         |   12
...

And You can check more details of update with “yum history <ID>”.

sigh

Ah...

By default, SL has similar functionality yum-autoupdate, which is enabled and executed on daily basis. So above configuration is duplicate and not necessary.

You can disable yum-autoupdate by configuring /etc/sysconfig/yum-autoupdate file.

ENABLED="false"

how to play minecraft on ubuntu

My daughter would like to play her favorite game, minecraft on her ubuntu box. Here is a short memo to summarize procedure to setup environment to play minecraft on ubuntu.

JVM

minecraft client is a jar file and you would better to have hotspot VM. You can install hotpost VM as follows:

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java7-installer

search path

As with default configuration shared object libjawt.so can not be found. You have to configure environment variable LD_LIBRARY_PATH so that libjawt.so can be searched for.

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/jvm/java-7-oracle/jre/lib/i386/

key input

As ibus interrupts key input on minecraft and You can not input any word on minecraft. You can avoid this problem by configuring following environment variable:

XMODIFIERS=@im=none

script

Here is sample script to launch minecraft. If you would like to speak something upon start-up, please install TTS engine, festival.

#!/usr/bin/env bash

LANG=C
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/jvm/java-7-oracle/jre/lib/i386/
XMODIFIERS=@im=none
export LANG LD_LIBRARY_PATH XMODIFIERS

MINE_HOME=~/minecraft
cd $MINE_HOME

START_MSG="start minecraft"
echo $START_MSG|festival --tts

LOG=play.`date "+%Y%m%d"`.log

echo "START: " `date` >> $LOG
java -Xmx1024M -Xms512M -cp minecraft.jar net.minecraft.LauncherFrame >> $LOG 2>&1
echo "FINISH: " `date` >> $LOG

register unity panel

You can launch above script directly from unity panel.

  • desktop file

Create desktop configuration file (e.g. minecraft.desktop) so that unity can evaluate how to launch application.

[Desktop Entry]
Type=Application
Terminal=false
Name=minecraft
Icon=/PATH_TO_ICON_DIR/minecraft.ico
Exec=/PATH_TO_SCRIPT_DIR/minecraft.sh

Put this desktop configuration file under /usr/share/applications directory.

  • unity panel

And drag & drop this desktop configuration file onto unity panel.