Purpose

Mainly documenting a few things I don't want to forget. Perhaps it's useful to others as well.

If you came here for FISHWORKS (which I'm pretty sure you didn't), click here

måndag 24 oktober 2011

Live screencasting with ffmpeg, ffserver

Put this ffserver.conf file on your server:

 Port 8090  
 RTSPPort 5554  
 BindAddress 0.0.0.0  
 MaxHTTPConnections 500  
 MaxClients 200  
 # 8 Mbits  
 MaxBandwidth 8000  
 CustomLog -  
 NoDaemon  
 <Feed screencast.ffm>  
     File /tmp/screencast.ffm  
     FileMaxSize 30M  
     ACL allow 0.0.0.0 255.255.255.255  
 </Feed>  
 <Stream screencast.swf>  
  Feed screencast.ffm  
  Format swf  
  VideoCodec flv  
  VideoFrameRate 20  
  VideoBufferSize 80000  
  VideoBitRate 768  
  VideoQMin 1  
  VideoQMax 5  
  VideoSize 1376x768  
  PreRoll 0  
  StartSendOnKey  
  AudioBitRate 64  
  AudioChannels 2  
  AudioSampleRate 44100  
  AVOptionAudio flags +global_header  
 </Stream>  
 <Stream status.html>  
     Format status  
     ACL allow localhost  
     ACL allow 192.168.0.0 192.168.255.255  
 </Stream>  
 <Redirect index.html>  
     URL http://www.ffmpeg.org/  
 </Redirect>  

here's a shortcut screencast.sh file, run this on your desktop machine you're screencasting from:
 #!/bin/sh  
 ffmpeg -f x11grab -r 25 -s wxga -i :0.0 -f alsa -ac 2 -ar 44100 \  
  -i hw:PCH,0,0 http://server:8090/screencast.ffm  

Now, simply log on to your server, run ffserver -f ffserver.conf. Then run screencast.sh from your desktop.

You might need to change the input device, you can list them with arecord -l.
Also, replace 'server' with your server address, and check the input dimensions (-s wxga above) and the output dimensions (VideoSize in ffserver.conf) it's a bit tricky and doesn't match the input size to 100%, because the VideoSize dimensions need to be a multiple of 16.

söndag 23 oktober 2011

The Shitty Logitech Squeezebox Radio

Ok, not all shitty once it actually works, but there's a problem with it's software (drivers) or wireless hardware, atleast in combination with my Netgear router.

With WMM enabled, things are really shitty... The Squeezebox shows meta information and browsing the directories is almost not shitty. It's experiencing general slowness and lag. Response to Squeezeboxserver remote commands are kind of random. And audio just doesn't play at all... On one occasion I saw the "Buffering" message reach a staggering 2%. Wow, that's only 98% shitty!

So, turning off WMM (Wireless MultiMedia extension support) in the router seems to fix the issue.



I've never had a problem until now with this on any of the 10-20 devices that's ever been hooked up to my router.

I'm going to say it again, if you have a similar wireless issue on your Shitty Logitech Squeezebox Radio - turn of WMM in your router.

onsdag 14 september 2011

Nokia N900 headset white M+ lead broken

So, after some reading about why my N900 didn't detect my headset as a headset I opened it up and indeed, it was just as they said. The white M+ lead is torn off the solder. I didn't open the headset up until after I had my entire N900 torn apart on my lunch break. At least I got a shitload of dust and pocket lint out of it.




Update:

I now have tools to try to fix this thing.


So, I had 3 minutes left before leaving for the station and soldered the mofo back together and the headset now works!

Update: 2011-10-20: Soldering broke and cable came loose while on my trip to the States, so I resoldered it again today at the office.

tisdag 30 augusti 2011

Compaq Mini 730OE Broadcom BCM4312 Wireless flakyness

Symptoms: Can't connect... 4-way handshake timeout. deauthenticated by Reason: 15.

First of all you need the b43 firmware:

apt-get install firmware-b43-lpphy-installer

Then put this in /etc/modprobe.d/b43.conf:

options b43 pio=1 qos=0

tisdag 29 mars 2011

FreeBSD ZFS Benchmarks






Some sysbench results on a HP ProLiant DL320s with 10 disks.
HP Smart Array P400 controller with 256MB cache. Each physical disk is it's own logical drive.

I know there's not much data or background. I will add more information later.
The script i used on each pool/filesystem.

I also used another script to parse each fileio output file into something usable.

zfs synopsis for all pools:
zpool create tank MEMBERS
zfs -o recordsize=16K tank/sysbench

where MEMBERS were one of the following:
da1 da2 da3 da4 da5 da6 da7 da8 da9 da10

mirror da1 da10 mirror da2 da9 mirror da3 da8 mirror da4 da7 mirror da5 da6

raidz da1 da10 da2 da9 da3 raidz da4 da8 da5 da7 da6

raidz2 da1 da10 da2 da9 da3 raidz2 da4 da8 da5 da7 da6

mirror da1 da10 da2 mirror da3 da9 da4 mirror da5 da8 da6

I'm more used with benchmarking on Linux so I've yet to come up with a really good comparative benchmark method.

I plan to add 2 x Vertex 3 Pro SSDs as cache and 1 x Intel X25-E as log device and try on a bigger dataset, pre-warmup and after post-warmup to see if there's good benefits from the SSD drives. The machine has 1G ram today, tomorrow I will have 6 or 7G ram in it.

tisdag 14 december 2010

Nokia N900 Maemo key remap

Issue: The bar symbol is missing on the N900 keyboard:
bar symbol ("|"):
File: /usr/share/X11/xkb/symbols/nokia_vndr/rx-51

In section:
xkb_symbols "nordic_base" {

Change:
key { [ c, C, bar, sterling ] };

Issue: The N900/Maemo sends Keypad_Enter, not Enter. Causing various things to fail on a remote tmux ssh session:
.tmux.conf: bind -n KPEnter send-keys Enter

Thanks hakan. Source: http://www.madhacker.org/computerincar.htm

måndag 13 december 2010

Nokia N900 Maemo Telenor fMMS Settings

Nokia N900
Maemo 5
Version: 20.2010.36-2
fMMS 1.3.0

The fMMS Settings that work on my Nokia N900 with Swedish provider Telenor are:

Internet connection settings
Access point name: services.telenor.se
MMSC: http://mms/
User name:
Password:
HTTP proxy: 172.30.253.241
Port number: 8799

Network mode: Havoc

fredag 5 november 2010

Apache PHP TypesConfig and the Upload file security risk

Reading the Bacula Mailing List I stumbled upon an informative blog and happened to read one of the posts a bit more tentatively than the others:
How Apache PHPs setting exposes a security risk


Now, reading that Apache, when configured with AddType or AddHandler, will execute any file with ".php" anywhere in it's filename, I was a bit chocked.

First I verified it on my server which is a Debian Lenny with Apache2 and php5.

I created the files somewhere in my webroot:
1. foo.php
2. foo.php.bar

Both files execute by the php engine.

But it gets worse...

I then removed EVERYTHING regarding php from my Apache2 configuration and restarted the webserver - Obviously, I would get plain ascii source code output this time.

Continuing I readded "LoadModule php5_module /usr/lib/apache2/modules/libphp5.so".

What now? Both files still execute by the php engine! Even without AddType, AddHandler or SetHandler.

The PHP Manual talks about a solution to use instead of AddHandler:
http://se2.php.net/manual/en/install.unix.apache2.php

Action Point 8:
Tell Apache to parse certain extensions as PHP. For example, let's have Apache parse .php files as PHP. Instead of only using the Apache AddType directive, we want to avoid potentially dangerous uploads and created files such as exploit.php.jpg from being executed as PHP. Using this example, you could have any extension(s) parse as PHP by simply adding them. We'll add .php to demonstrate.
And it includes a snippet for a suggested practice:
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Now, atleast in my case this doesn't help since a simple LoadModule activates the awesomeness of *.php*.

This is, I found, due to the Apache TypesConfig directive.
Debian Apache include: "TypesConfig /etc/mime.types" if mod_mime is loaded.
Contrary to the Apache documentation on TypesConfig, the extensions in that file are not actually extensions.... they're substrings!

My solution:
/etc/apache2/conf.d/php-safer.conf:
<FilesMatch "[^(\.php)]$">
php_admin_flag engine off
</FilesMatch>

torsdag 9 september 2010

because a quiet mysql import is no fun

time pv -c -N gz /tmp/mysqldump.sql.gz | gunzip -c | pv -c -N unpacked | perl -pe 'print STDERR ($_) unless m/^INSERT/i' | mysql-main

...
unpacked: 611MB 0:02:20 [4.41MB/s] [ <=> ]
gz: 69.6MB 0:02:20 [ 469kB/s] [> ] 0% ETA 9:56:01
...

måndag 6 september 2010

tisdag 31 augusti 2010

Todays fulhack: On Call Diversion script for Nagios

A little concept hack that'll be used in Nagios to set diversion for the on call number as well as control who gets sms and when.

(c) 2010 Fulhack Industries

The divert method in this one is done through Telenor but it could just as well be through a GSM modem or a Nokia/Ericsson phone connected via USB.
https://minasidor.telenor.se/


tisdag 13 juli 2010

ircd-seven start scripts

ircd:

#!/bin/bash
#
# /etc/rc.d/init.d/ircd
#
# IRCd-seven
# Script to start and stop IRCd-seven
# Author: Mikael Fridh
#
# chkconfig: 2345 90 10
# description: IRCd-seven is an IRC daemon
# processname: ircd
# config: /usr/local/ircd/etc/ircd.conf

# Source function library.
. /etc/init.d/functions

# Defaults
IRCD_USER=ircd

# Pull in settings:
[ -f /etc/sysconfig/ircd ] && [ . /etc/sysconfig/ircd ]

start() {
echo -n "Starting ircd: "
daemon --check ircd --user ${IRCD_USER} /usr/local/ircd/bin/ircd
echo
touch /var/lock/subsys/ircd
return 0
}

stop() {
echo -n "Shutting down ircd: "
killproc ircd
echo
rm -f /var/lock/subsys/ircd
return 0
}

case "$1" in
start)
start
;;
stop)
stop
;;
status)
status ircd
;;
restart)
stop
start
;;
reload)
echo -n "Sending ircd the HUP signal ..."
killproc ircd "-HUP"
echo
;;
condrestart)
[ -f /var/lock/subsys/ircd ] && restart || :
;;
*)
echo "Usage: ircd {start|stop|status|reload|restart|condrestart}"
exit 1
;;
esac
exit $?

torsdag 1 juli 2010

Wrote an article (howto) on incorporating vmware view in Ubuntu LTSP

I wrote this a couple weeks ago;
http://help.ubuntu.com/community/UbuntuLTSP/VMWareViewVDI

In short; Allows you to create a thin client out of any commodity hardware PC, for use with a Vmware View Server.

LTSP is a really nice project... kudos to ThinStation, but I got way better performance out of VMWare View on Ubuntu than on ThinStation... mainly due to poor graphics driver support in ThinStation.

onsdag 21 april 2010

xorg.conf ModeLine for HP2159v

So I got a new Desktop Computer (Dell Precision 380) and a Monitor: HP2159v, a 21.5" Full-HD monitor, it's perfectly fine, nice picture quality. Downside - the only connector is VGA, no DVI, no HDMI. I'm happy with whatever I get since I've exclusively been using laptops for 6 years now.

This config got 1920x1080 resolution going for me:

Section "Monitor"
Identifier "HP2159v"
# 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
HorizSync 24.0 - 94.0
VertRefresh 50.0 - 76.0
Modeline "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
EndSection

Section "Screen"
Identifier "Default Screen"
Monitor "HP2159v"
Device "Configured Video Device"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080" "1024x768"
EndSubSection
EndSection

Section "Module"
Load "glx"
EndSection

Section "Device"
# nVidia Corporation NV41GL [Quadro FX 1400] (rev a2)
Identifier "Configured Video Device"
Driver "nvidia"
Option "NoLogo" "True"
EndSection

söndag 21 februari 2010

Stream sound from Windows to Linux with LiveInCode and PulseAudio

My OS's: Debian 5.0 Lenny / Windows Vista Home Premium.

Debian 5.0 (Lenny):
1. sudo apt-get install pulseaudio alsa-utils
2. sudo alsamixer -Dhw crank volume, unmute ...
3. pulseaudio --log-target=stderr
4. alsamixer -Dpulse crank, unmute ...


Windows Vista, configure Recording Mixer.:
1. Go to Recording Devices -> Recording.
2. Right click a free area in the recording device list -> mark "Show Disabled Devices"
3. Now enable "Stereo Mix".

Windows Vista, the Levels I chose for minimum distortion.
Click Properties on "Stereo Mix". Choose "Levels". Crank Stereo Mix to 100.
Set the Main output Level to 50.
Next, I jacked a headphone jack (3.5mm) into my laptops headphone outlet in order to physically mute it.

Windows Vista, software:
1. Install Cygwin.
2. Install LineInCode: http://liveincode.rm.pp.ru/
3. Put lineco.exe in your path for simplicity.
4. Launch cygwin, run linco.sh after putting the following in it:

linco.exe --flag-files -B 16 -C 2 -R 48000 | ssh mikaelf@host.internal.example.com "pacat --rate=48000 --playback"

Now all your audio is "routed" to your Linux Machine!
Note: I used SSH public keys for the ssh connection.

Next, wrap the linco.exe line in a while [ 1 ]; do linco ...; sleep 60; done to make it autorestarting in case you lose connection to your sound server.

Things to note:
You might be using 44.1Khz rate all over, make sure you adapt your settings and scripts so the rate matches on both hosts.

References:

torsdag 26 mars 2009

Ubuntu 8.10 Intrepid on Asus EeePC 901Go

So, got my Asus EeePC 901Go 3G and after reading alot of recent praise for Ubuntu on it (even Vanilla Ubuntu) I decided to go for that. I like to keep as close to upstream as possible.

CPU Model: Intel Atom N270
Chipset: Intel 945GSE


Preparing for Installation

ISO: http://se.releases.ubuntu.com/releases/8.10/ubuntu-8.10-desktop-i386.iso
Boot the Ubuntu Live CD and, or from an already installed Ubuntu, launch usb-creator.
Insert a pen drive, choose your CD or ISO and create the startup media.
Make sure you have a Wire connection or a Mobile Broadband sim card because your wireless network adapter will not work out of the box.

Installation

Insert the pen drive in your Eee, boot it by pressing Esc for BBS Popup Menu and choose to boot from pen drive.
Install Ubuntu as usual.

Issues
During installation I could not reach the "Next" icons with the mouse pointer. I blindly pressed Enter to get past the first few installation dialogues.
Note: I performed my first installation in Safe graphics mode and after that installation my Ubuntu only showed 800x600 resolution. Probably because it adds Driver "vesa" to xorg.conf

First boot
Log in and install software upgrades.

Wireless Support


* Download compat-wireless for kernels >= 2.6.27.

Follow the instructions to Build, Install, Unload, and Load (modprobe ath5k or reboot)

Hot Keys & OSD:
http://greg.geekmind.org/eee-control/

Other tweaks:

http://hehe2.net/linuxhowto/howto-your-perfect-ubuntu-on-your-perfect-eee-pc/