/etc/odbcinst.ini : list of the available drivers and default configuration for each driver
/etc/odbc.ini : list of the instances/databases for *all* users aka “System DSNs”
${HOME}/.odbc.ini : list of the instances/databases specific to *you* aka “User DSNs”

Add/update the following lines in the /etc/odbcinst.ini file (or wherever the file is as reported by odbcinst -j). Make sure there is no whitespace at the beginnings of the lines.

If you connect to a remote system or run a script through a cron like scheduler, you may encounter an error message from the stty or some such program:

stty: tcgetattr: Not a typewriter

The error is raised because your script is being run in a non-interactive mode and the stty program is expecting to have access to a terminal (ptty / tty). If your script isn’t explicitly calling stty, check any scripts that you’re sourcing and you will find code similar to the following:

set -o vi
stty erase ^H

So, how do you work around this? Easily, simply check if the script is running in interactive mode.

if [[ $- = *i* ]]; then
set -o vi
stty erase ^H
fi

The shell special variable $- will list the shell modes that are active.

Retrieving the user that you logged in as while running sudo or su’d into another user can be painful if you don’t have access to root. Here’s a short script that will retrieve the original user that was your session logged in as.

I needed an easy way to determine which process was listening on a port. For AIX, you need to get the socket id from “netstat -Ana” and use the rmsock “rmsock socket_id tcpcb” to get the PID and command. It would be easy to expand this out to list command line and owner for each PID.

I think a lot of people have been struggling with mass converting of videos for the ps3…
I’ve been searching for a way to mass convert my videos (mostly podcasts) to play on my Sony PlayStation 3 over the wire with Mediatomb. For a long time I’ve been using a hodpodge of mp4box and mencoder to convert the videos. The problem was that mp4box more often then not would crash or get stuck in a loop where it fills up a 1TB harddrive converting a 20mb file. There had to be a better way.

If your ffmpeg doesn’t support x264 (video) or aac (audio) encoding, like all Ubuntu Linux distributions, then you will have to recompile ffmpeg. Don’t worry, it is easier then you think!

Install x264
3. Get the most current source files from the official x264 git repository, compile, and install. You can run “./configure –help” to see what features you can enable/disable. If you are behind a firewall or unable to use git, then daily source tarballs are also available.

Install FFmpeg
4. Get the most current source files from the official FFmpeg svn, compile, and install. Run “./configure –help” to see what features you can enable/disable. If you are behind a firewall or unable to use subversion, then nightly FFmpeg snapshots are also available.

You ssh to a remote server with your login and either sudo or su to another user to run some application that uses a X Windows front end. There is a firewall between your desktop and the remote server that allows only ssh connections (port 22). When you run into the error “Xlib: PuTTY X11 proxy: wrong authentication protocol attempted”. What to do?

On recent OpenSSH Server releases, you can simply enable “ForwardX11Trusted yes” in the /etc/ssh/sshd_config file and restart the OpenSSH server. If you’re not using a recent OpenSSH Server release or if you can’t for security or political reasons, what could you do? Give up? It’s simpler than you think.

You need to temporarily transfer the authorization to the other account. First, get the key from your account:

If you don’t want to mess around with windows scripting and you just want to get the job done, well, the easiest method is sometimes the not so obvious… use smbclient! It’s part of Samba (no, not the samba style of music).

I’ve created a very simple script to automate smbclient. It assumes that the login name, password and the directory on each of the windows boxes are the same.

Note that the directory is relative to the windows share. For example the following two windows machines share the sybase directory as “sybase”. Whether actual location of sybase is located on the C drive or somewhere else, doesn’t really matter as it is simply “\\<server>\sybase” to the rest of the network.

c:\sybase shared as \\mywin2k\sybase

d:\sybase shared as \\mywin2k3\sybase

Put either the ip address or the name of each of the windows machines you want to upload your file to into the smb_ips file.

Change the smb_user and smb_pass to your windows login/password. Next, change upload_file to point to the file you need to upload to the windows box. Finally, change the upload_dir to the directory on the windows box you want to upload the file to.