Power control and capping on Dell servers using RACADM

Usage: SSH -> racadm ->
Get current value: getconfig -g <group> -o <object>
Set a value: config -g <group> -o <object> <new_value>
Do “help” to get list of groups.
Do “help <groupname>” to get objects for a particular group.

Get current draw:
racadm getconfig -g cfgServerPower -o cfgServerActualPowerConsumption
108 W | 369 Btu/hr

Enable power capping:
racadm config -g cfgServerPower -o cfgServerPowerCapEnable 1
Object value modified successfully

Set cap:
racadm config -g cfgServerPower -o cfgServerPowerCapWatts 400
Object value modified successfully

racadm getconfig -g cfgServerPower -o cfgServerPowerCapWatts
400 W

Get total kVh:
racadm getconfig -g cfgServerPower -o cfgServerCumulativePowerConsumption
292.370 KWh | 997859 Btu

Instant web server with Python!

Have you ever wanted to copy something from one machine to another without having to setup FTP, NFS, Samba etc? Luckily Python offers to help by creating an instant web server in the directory it’s launched from:

Listening on port 8000 (default):
python -m SimpleHTTPServer

Listening on port 8080:
python -m SimpleHTTPServer 8080

Then just use wget from the other machine to download the file(s) you want. Magic!

Record video in Linux with avconv and ffmpeg

Record screen in Linux with avconv (replacement for ffmpeg in Ubuntu):
avconv -f alsa -i pulse -f x11grab -r 25 -s 1920×1080 -i :0.0+0,0 -vcodec libx264 -pre:0 lossless_ultrafast -threads 0 video.mkv

Compress video and make ready for YouTube:
avconv -i video.mkv -c:v libx264 outputfile.mp4

Record screen in Linux with ffmpeg:
jonas@erebus:~$ ffmpeg -f x11grab -r 15 -s 1280*800 -i :0.0 -vcodec libx264 -vpre lossless_ultrafast -threads 4 -y -sameq out.mkv

Compress video and make ready for YouTube:
ffmpeg -i video.mkv -vcodec libx264 -vpre hq -crf 22 -threads 0 video.mp4

Automatically mount SMB / CIFS / Windows share on Debian at startup

As root user, create a credentials file.
Note that <user> and <password> should be entered without “<>” brackets.
root@Erebus:~# cat > .smbcredentials

Add a line to your /etc/fstab:
Specify the local machine username which you will access the share as
//<server-IP>/<server-share> <local-mount-point> cifs uid=<local-username>,credentials=/root/.smbcredentials,iocharset=utf8,sec=ntlm 0 0

In my case it looks like this:
// /media/BIGBOX1 cifs uid=jonas,credentials=/root/.smbcredentials,iocharset=utf8,sec=ntlm 0 0

If things don’t work, try mounting the share manually first. Also, ensure that cifs-utils is installed.

Examples of backing up DVD’s with Handbrake / HandbrakeCLI

Backup with default language:
HandBrakeCLI –main-feature -i /dev/cdrom -o movie.mp4 -e x264 -b 1000 -B 192

Backup with 2nd language:
For example English language DVD with additional Japanese audio track. The switch “-a” and then the number for the audio track desired will replace the default audio in the resulting mp4 file.
HandBrakeCLI –main-feature -i /dev/cdrom -o movie.mp4 -e x264 -b 1000 -B 192 -a 2

Backup with default language and subs:
HandBrakeCLI –main-feature -i /dev/cdrom -o movie.mp4 -e x264 -b 1000 -B 192 -N jpn

NOTE: The “–main-feature” results in an initial scan of the media to find and correct inconsistencies. This is helpful if the DVD authors have anticipated the media to be copied and therefore randomly scrambled the order of the chapters.

Enabling DVD backup / playback on Debian Wheezy

First ensure that apt has access to the relevant sources. My /etc/apt/sources.list is as follows (please update to reflect your local mirror – I’m in Japan, hence the “jp”):
deb http://ftp.jp.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.jp.debian.org/debian/ wheezy main
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib
deb http://ftp.jp.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.jp.debian.org/debian/ wheezy-updates main contrib
deb http://www.deb-multimedia.org wheezy main non-free

Run update:
apt-get update

Install the deb-multimedia keyring:
apt-get install deb-multimedia-keyring

Run update:
apt-get update

Run dist-upgrade:
apt-get dist-upgrade

Install all libdvdcss packages:
apt-get install libdvdcss*

Try it out with vlc or Handbrake or your favorite player

If there are issues, try installing libavcodec-extra:
apt-get install libavcodec-extra-53