Quick Command Line Video Excerpt

Do you have a video file you want to extract a clip from?

I found it difficult to locate this information and learned a lot in the process. Most importantly, the order of options in avconv command matters. You can refer to the manual here.

avconv -ss [start time = hh:mm:ss] -i [input filename] -t [clip duration = hh:mm:ss or in seconds] -codec copy [output filename]

For example, to create a 79 second clip from a video file that starts at 58 minutes and 25 seconds in the original video:

avconv -ss 00:58:25 -i 1995-8mm-home-video.dv -t 79 -codec copy 1995-guinea-pigs-garage.avi

How to get your Logitech DiNovo Mini to work in Ubuntu

I am writing this post because I forgot to bookmark the forum thread where I originally read the solution. So I backtracked using the .bash_history file, and compared it with an original version.

Start by unpairing the keyboard from your computer. Then open




from the following line

KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[3bc]", \

so it looks like

ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[3bc]", \

and reboot and pair it!

Compile Latest Ganglia for All Versions of Debian and Ubuntu

I have learned a lot since I wrote the original how-to. I do not have time to write a nice story but follow the steps below and you should be fine. This will provide you with the latest version of Ganglia on any Debian based distro.

1. Download latest sources from Ganglia git repository.
2. Compile, install and setup monitor-core.
3. Setup ganglia-web front-end.
4. Setup hsflowd on servers.

On your collector / PHP enabled web-server:

apt-get install build-essential automake autoconf pkg-config gperf libtool rrdtool librrd-dev libconfuse-dev libapr1-dev libpcre3-dev

cd ~
git clone https://github.com/ganglia/monitor-core.git ganglia
cd ganglia
git submodule init
git submodule update


Update February 1, 2014: You need to install Concurrency Kit before running configure or it will fail.

"git clone http://concurrencykit.org/cgit/cgit.cgi/ck/"; "cd ck"; "./configure"; "make"; "make install"

and then switch back to your ganglia directory and continue.

./configure --with-gmetad
make install
ln -s /usr/local/lib64/ganglia /usr/lib/ganglia
useradd --system ganglia
groupadd --system ganglia

nano /etc/ld.so.conf
add line: /usr/local/lib


nano /usr/local/etc/gmetad.conf
change: data_source "your cluster name" 20 localhost
cp ~/ganglia/debian/gmond.conf /usr/local/etc/gmond.conf
nano /usr/local/etc/gmond.conf
change: mute = yes
change: name = "your cluster name"
udp_send_channel {
  port = 8649
  ttl = 1
udp_recv_channel {
   port = 8649
sflow {
  udp_port = 8649
  accept_vm_metrics = yes
tcp_accept_channel {
  port = 8649

cd /var/www
git clone https://github.com/ganglia/ganglia-web.git ganglia
cd ganglia
mkdir dwoo/compiled
mkdir dwoo/cache
mkdir -p /var/lib/ganglia/rrds
chown nobody /var/lib/ganglia/rrds
chown -R www-data:www-data /var/www/ganglia
cp conf_default.php.in conf_default.php
cp version.php.in version.php
nano conf_default.php
change: $conf['gweb_confdir'] = "/var/www/ganglia";
change: $conf['gmetad_root'] = "/var/lib/ganglia";


On servers you want to monitor:

apt-get install hsflowd

Note: This package does not appear to be included anymore. Visit their website.

nano /etc/hsflowd.conf
change: DNSSD = off
change: polling = 20
change: sampling = 2000
collector {
ip = (IP running gmond+gmetad)
udpport = 8649

/etc/init.d/hsflowd start

Visit your webserver to see your graphs. DONE!

NOTE: There is a mistake in stacked.php as of January 16, 2013 which causes the graph to break. The exact error is: “PHP Parse error: syntax error, unexpected T_FOREACH in /var/www/ganglia/stacked.php”

To fix, search for “$min_index = min(array_keys($hosts))” and add a semi-colon to the end of the line:

nano /var/www/ganglia/stacked.php
change: $min_index = min(array_keys($hosts));

EDIT (8/5/2013): I recently read this article and decided to set my sampling rate to 2000. I was occasionally getting errors where my network speed was being measured in petabytes/s! Here is a second article about the same topic that is also worth a quick read.

Logrotate MySQL Cron Error

I have been receiving the following email report:

error: error running shared postrotate script for '/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1

Most recommendations to fix this problem suggest updating the debian-sys-maint password for the MySQL server to match the one in /etc/mysql/debian.cnf.

This will not fix the problem if MySQL is not logging. Check if logging is turned on in /etc/mysql/my.cnf.

If you choose only to log errors then remove /etc/logrotate.d/mysql-server.

You should no longer get this error!!

phplist SMTP w/ SSL

Update (Nov 25, 2013): Instructions for version 3.0.5

1. Rename config_extended.php to config.php

2. Uncomment line 558.


3. Set mail server on line 535.


4. Uncomment line 543, 544, 547.

Fill in the username, password and SSL port number.

5. Set line 213 to 0.

define ("TEST",0);

The above steps should be all you need to do to setup SMTP w/ SSL on the current version. There is no longer a need to edit any file other than config.php.

Update (Aug 18, 2013): The newest version of phpList’s config.php has settings for using secure SMTP. I suggest you use the new config file by copying your settings from the old config file. Enjoy!

Update (Nov 20, 2012): This still works for 2.10.19! 🙂

Update (Nov 7, 2011): I just upgraded to 2.10.17 and can confirm this still works.

Original Post (Jun 7, 2011): When I updated phplist to 2.10.14 I forgot that there were a few modifications required for using SMTP with SSL. This may be the reason your phplist will not send mail.

Searching resulted in many forum threads which had numerous suggestions. I checked the old files and found that the following modifications, in the past, had allowed me to send mail via SMTP with SSL.

config/config.php settings:

$phpmailer_smtpuser = 'LOGIN';
$phpmailer_smtppassword = 'PASSWORD';
$phpmailer_smtpsecure = 'ssl';
$phpmailer_smtpport = 465;

Open admin/class.phplistmailer.php and locate:

$this->Password = $GLOBALS['phpmailer_smtppassword'];

Below it insert:

$this->SMTPSecure = $GLOBALS['phpmailer_smtpsecure'];
$this->Port = $GLOBALS['phpmailer_smtpport'];

Open admin/phpmailer/class.smtp.php and locate:

$this->smtp_conn = fsockopen($host,





You should now be able to send mail!!

Setup PSAD in Ubuntu 9+

Psad scans your firewall log in real time. It can be configured to automatically drop packets and more. While reading the guides that are available for this I ran into a problem, there was no /etc/syslog.conf. On Ubuntu’s webpage I found this release note. It says that as of Ubuntu 9.10, syslog has been upgraded with rsyslog. This can make setting up psad a little tricky.

This guide has been tested on Ubuntu 10.04 LTS Server and 10.10 Desktop

The first thing to do is install psad:

sudo apt-get install psad

Now edit the config file:

sudo nano /etc/psad/psad.conf

Change “ENABLE_SYSLOG_FILE Y;” to “ENABLE_SYSLOG_FILE N;”. We will not need psad to read our syslog.

Another setting to review right now depending on your environment is “EMAIL_ALERT_DANGER_LEVEL”.

Set the email at the top of the config file or leave the default, root. I have root’s mail set to forward to my real email address. To forward root (or any user’s) mail: place a file named “.forward” in their home folder. Inside the file enter the email address where the mail is to go.

Restart psad:

sudo /etc/init.d/psad restart

Next: configure iptables to log the non-legitimate packets. The logging rules need to go after the accept rules but before the drop. Confusing? It was for me.

For example, my default policy for INPUT and FORWARD is to DROP. After this my accept rules for specific ports are appended. Meaning our logging rules must go at the end of the file, before they are dropped because the packets were not accepted by any previous rules.

$IPT -A INPUT -j LOG --log-prefix "firewall1 "
$IPT -A FORWARD -j LOG --log-prefix "firewall1 "

The prefix is going to allow rsyslog to filter the messages. After applying the log rules it is possible to view the end of the syslog to see if logging is working.

sudo tail /var/log/syslog

The last step is for rsyslog to send the messages that contain “firewall1” to psad’s pipe.

sudo nano /etc/rsyslog.d/50-default.conf

We are going to place our rules at the top of the file. That way we can stop “firewall1” messages from making it to any other logs.

:msg, contains, "firewall1" |/var/lib/psad/psadfifo
:msg, contains, "firewall1" ~

Note: the ~ means to discard.

That’s it! Restart rsyslog:

sudo restart rsyslog

To view psad’s status:

sudo psad --Status

Comments and suggestions are welcome!!

Setup Samba on Ubuntu

Updated December 24, 2012. This works on all versions of Ubuntu.

Authenticated network file access is very helpful on your home LAN.


sudo apt-get install samba


sudo nano /etc/samba/smb.conf

Enter details for the share at the end of the file. Leave the rest of the file default for now. Go back later and edit it.

# Name
# Path
# Restrict access. Useful with multiple shares/users.
valid users=user_name,user_name2
# Enable write access.
read only=no

For more options visit the smb.conf man page: http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html

Start Service:

sudo restart smbd

Note: You must restart the samba daemon for any of the above changes to take effect.

Adding users:

sudo useradd user_name --shell /bin/false
sudo smbpasswd -a user_name

Hint: Use your Windows username and password. This will grant password-less access to the share.

For more options visit the smbpasswd man page: http://www.samba.org/samba/docs/man/manpages-3/smbpasswd.5.html

Accessing the share in Windows:

In the address bar of file explorer:


StatusNet XMPP and GTalk Setup

I tried to get StatusNet’s XMPP bot to connect to GTalk’s servers and got this error: “If set, the ‘from’ attribute must be set to the user’s full JID.” Furthermore, I could not send or receive messages from the bot. It was connected, though. I am using the current version of StatusNet, 0.9.7fix1.

After some extensive searching and not finding anything helpful I fiddled with some of the settings. The change from the example that made everything work was:

$config['queue']['enabled'] = true;


$config['queue']['enabled'] = false;


If you are using Google Apps for your domain the XMPP settings can be a tricky. This is exactly from my config.php and is setup for update@domain.com.

# xmpp
$config['xmpp']['enabled'] = true;
$config['xmpp']['host'] = 'talk.google.com';
$config['xmpp']['server'] = 'domain.com'; # domain name
$config['xmpp']['port'] = 5222;
$config['xmpp']['user'] = 'update'; # user name
$config['xmpp']['encryption'] = true;
$config['xmpp']['resource'] = 'updatebot'; # something unique
$config['xmpp']['password'] = 'password'; # user password
$config['xmpp']['debug'] = false;
$config['queue']['enabled'] = false;


Good luck with your setup and happy micro-blogging!

Update: If using GTalk you will need to login to the bot’s account to accept the invitation request.

Asus RT-N16 DD-WRT: best wireless settings for streaming

MAJOR UPDATE JANUARY 10, 2013: I installed the stock firmware today. The speed is incredible! DD-WRT firmware and my ISP’s speed test peaks at 100 Mbps. So far the stock firmware peaked at 229 Mbps. The limiting factor is probably my ISP. WiFi is also at least 4x faster. Bye for now DD-WRT… I will miss your features! Just kidding. I setup DD-WRT on a WRT54GL as an OpenVPN client. That is the feature I use which doesn’t come with stock firmware. Click here to go to the Asus RT-N16 product page.

I rewrote this to make it easy to follow. If you are having lots of problems – a 30/30/30 to clear the NVRAM may be necessary. Please comment if you have any recommendations. Thanks!

=> Basic
-NTP client: enable
-time zone: (yours)
-server: pick a pool for your region here

=> Basic
-mode: AP
-network mode: N-only
-channel: 6 (Find the one with the least noise by doing a “site survey.”)
-width: 20 MHz
-sensitivity range (ACK timing): 0
-network configuration: bridge

=> Security
-mode: WPA2 personal
-algorithim: AES

=> Advanced
-CTS: disable
-frame burst: disable
-beacon: 100
-preamble: short
-shortslot override: short
-tx power: 17 (Here is a thread about this setting for this router.)
-WMM support: enable
-no-acknowledgement: disable

=> Keep Alive
-schedule reboot: enable
-time: 05:00 everyday

After rebooting, make sure the settings were saved.