New site – MyIP.Rocks

Need to know what your real public IP address is? See myip.rocks

It just gives you your IP in large, friendly letters. Don’t panic.

Share Button

Mary Moon is for sale! SOLD

The boat is sold – keeping this here for nostalgia.

 

My Grampian 26 sailboat, Mary Moon, is for sale!

See http://www.g26.ca

Share Button

Launch of aproposmarine.com

Today marks the launch of a site I’ve been working on for a small Canadian business that designs and manufactures (in Canada) pleasure boat accessories. There are nifty cup holders, mounts for chart plotters and other instruments, and more.

 

Check it out at http://www.aproposmarine.com

Share Button

ListeningCam – Audio Sensing Video Recording on Android

I have been working on an Android app that I find useful: Recording video when there are noises. I initially got the idea when I was wondering if the dog was being good when I am not home, but couldn’t find an app that does this.

Here’s a result of an early test when it was listening for the dog (Note that I’m having it save videos in tiny resolution while testing):

It’s pretty basic so far, but is still a work in progress and hopefully I’ll have something I can distribute soon.

Screenshot:

Screenshot_2015-01-12-19-45-32

You can view the source code at my GitHub repository.

An APK file is also available for download, but do note that there are still issues, and it may crash, require you to restart your device, etc, but here it is: http://dotslash.ca/ListeningCam/ListeningCam.apk

 

The video will start recording when audio level gets above the threshold, and can record for a set amount of time, or record until a certain duration of silence has elapsed.

Some features I may add:

  • Ability to upload automatically to a server
  • Notifications with images or videos sent to email or SMS
  • Ability to check live feed remotely via Internet.
  • Timestamps on the video
  • Delayed start
  • Schedules
  • Better power management
  • Ability to save only audio and no video
  • Motion sensing
Share Button

Highlight Tabs in Firefox!

Ever have an absurd number of browser tabs open and have trouble finding a certain one? Me too, so I wrote an add-on for Firefox to highlight tabs in different colours.

Highlight Tabs addon

See https://addons.mozilla.org/en-US/firefox/addon/highlight-tab/ to download.

To view or download the source (which may include newer updates), go to https://github.com/pvint/highlighttab or check out the git source directly: git clone https://github.com/pvint/highlighttab.git

Updates and new information will be posted at my main page for the addon.

Share Button

Backing up MySQL database by database and table

Backing up mysql databases using mysqldump is pretty quick and painless:
mysqldump -u username -ppassword -h hostname db_name > backup_file.sql
or
mysqldump -u username -ppassword -h hostname --all-databases > backup_file

The only problem is that it becomes quite cumbersome recover a particular table.

I wrote a little script to backup each table in each database to its own file:

#!/bin/bash

if [ $# -lt 2 ]
then
        echo "Usage: backup_all_tables username password [host]"
        exit
fi

mysql_bin="/usr/bin/mysql"
mysqldump_bin="/usr/bin/mysqldump"
backup_path="/opt/backups/www/"

if [ $# -eq 3 ]
then
        host=$3
else
        host="localhost"
fi

user=$1
pass=$2

for db in `echo "show databases" | $mysql_bin -u $user -p$pass -h $host | grep -v Database | grep -v information_schema`
do
        for table in `echo "show tables" | $mysql_bin -u $user -p$pass -h $host $db | grep -v "Tables_in"`
        do
                echo "Backing up $host.$db.$table to $backup_path${host}_$db.$table.sql"
                $mysqldump_bin -u $user -p$pass -h $host $db $table > ${backup_path}${host}_$db.$table.sql
        done
done

save the script as “backup_all_tables.sh”, edit the $backup_path variable to suit, do a chmod +x backup_all_tables to make it executable, and run it using:
./backup_all tables username password hostname
If the database is on your local machine you can omit the hostname.

This will backup the files in the format “host_db.table.sql”, ie: “localhost_mysql.user.sql”

Share Button

Pronounceable Password Generator

Here’s a simple online password generator – I’ll likely add some features, but it works.


Number of passwords:





 


Share Button

Huge sendmail queue – clearing it out

There are numerous reasons that the mail queue can get over full, ranging from general network problems, to having a user repeatedly sending an email with a large attachment to an incorrectly typed address.

The first thing you likely want to do is get some information on what’s in the queue:
To find out how many messages are in the queue:
mailq | tail -1
This will give you the total number of emails in the queue, ie:
Total requests: 6592
You might also want to know how old or new they are, so:
ls -lt | tail -10
and
ls -ltr | tail -10
will show you the oldest 10 and the newest 10 respectively.
To have sendmail retry the emails, simply run (as root):
sendmail -q -v
If you are in a situation where it has filled up the disk and need to fix it FAST, move the directory to another partition and then have sendmail process it from there (stopping sendmail with “/etc/init.d/sendmail stop” is recommended:
mkdir /root/tmpq
mv /var/spool/mqueue/* /root/tmpq
sendmail -q -v -oQ/root/tmpq

(if you get an error like “Argument list too long” instead run “mv /var/spool/mqueue /root/tmp” with sendmail stopped, then restart it)

Share Button

Recursively Change Text in Files

Handy little Perl one liner example to find and replace text across multiple files/directories… as an example, to change every .php file recursively from the current directory, changing “find this” to “replace with this”:

find . -name '*.php' -print0 | xargs -0 perl -pi -e 's/find this/replace with this/g'

Share Button

Support for JACK Audio in Adobe Flash

I use JACK quite frequently for playing guitar and recording etc, and while it is quite flexible, one thing I was unable to do was this: Get Flash audio to route through JACK. Most commonly this is when I want to play a Youtube video, and I find I have to stop jackd, which requires shutting down most JACK-aware applications, play the video, restart JACK, blah blah blah. Not really functional.

 

A quick search and I found libflashsupport-jack – and was excited! Look, something to make Flash work with JACK! So I checked out the git repo at git://repo.or.cz/libflashsupport-jack.git but it wouldn’t compile. Looked into it, and the major problem was that it includes a deprecated file in the kernel headers: linux/videodev.h, but alas, as of kernel version 2.6.38 the header file linux/videodev.h is no longer included in the kernel.

 

Long story short: I got the file, put it in with the libflashsupport source, hacked around with the code a bit, and TADA! I can now play Flash when JACK is running!

 

Even more importantly, for you that is, I’ve made a fork of the old repo, and have made the new working version available!

 

I’ll set up a proper homepage for this little project, but for now I’ll just link to the github repo and some instructions Note: if you go to http://github.com/pvint/libflashsupport-jack2 there is also a link to download a zipfile):

git clone git://github.com/pvint/libflashsupport-jack2.git
cd libflashsupport-jack2
sh bootstrap.sh
make
make install

(You must be root to do the make install, of course)
On a 64bit platform, you’ll likely need to create a symlink as well to get Flash to use this:

ln -s /usr/local/lib/flashsupport.so /usr/lib64

 

Now, fire up your JACK and your browser (You may need to restart the browser if it’s running), and try it out, it should just work!

 

If you have any issues, feel free to drop me a not here or by email.

Share Button