shawn's blog
Random Rename file with md5 Hash [Scripts]
Submitted by shawn on Tue, 06/29/2010 - 22:06Sometimes I find it handy to randomly rename files with md5 hashes. Don't you ever feel like you need to do that? This script involves a line of PHP so to use it make sure you have PHP installed on your system.
It accepts either a file or a wildcard glob such as '*.jpg' (no quotes).
#!/bin/bash
while [ $# -gt 0 ]
do
if [ -f "${1}" ]; then
sz_basename=`basename "${1}"`
sz_dirname=`dirname "${1}"`
NEW_FILE=`php -r "echo md5('$sz_basename'.mt_rand());"`.${sz_basename#*.}
echo "$1 => ${sz_dirname}/${NEW_FILE}"
mv "$1" ${sz_dirname}/${NEW_FILE}
fi
shift
done
bz2 Compress a Folder [Scripts]
Submitted by shawn on Tue, 06/29/2010 - 21:57I use a ton of bash scripts when I'm working at my Mac or at a Linux workstation. It's time to document these things.
This is a real simple one. It expects a single parameter and it expects that parameter to be a folder name that you'd like to bz2 compress. The tar.bz2 compressed folder is written to the same parent directory as the folder you pass as a parameter.
#!/bin/bash
if [ -d "$1" ]; then
tar -cjf "${1}.tar.bz2" "$1"
else
echo "error: expected directory as first parameter"
echo "useage: $ dirtobz2 path/to/folder"
fi
Stopping Terrorism
Submitted by shawn on Tue, 01/05/2010 - 12:49Somehow I don't think that stopping people from taking pictures is going to stop terrorism or really have any effect at all.
Convert Video Files to DVDs at a Terminal in Linux
Submitted by shawn on Tue, 08/11/2009 - 19:37So you've got a pile of videos you've snagged from the Internet or maybe you've been making your own videos with your own camera but you want to throw them onto a DVD for viewing on your DVD player. Of course there's applications that take care of this for you - you can do this with applications that come installed by default in Macs. Windows and Linux users aren't quite so lucky. I'll show you in this post how to create a simple DVD (no menus) using a few applications you can install for free in Linux. I'm also writing this from the point of view of an Ubuntu system.
Use Your SSH Server to Create a SSH-tunnelled SOCKS proxy
Submitted by shawn on Tue, 08/11/2009 - 19:13If you're out and about using untrusted networks (your favorite WiFi hotspots, someone's unsecured WiFi as you randomly drive around looking for a connection, etc) you might not want to be doing your internet business over that connection in case someone is sniffing the network. By using a SSH server on a network that you do trust you can create a secure SSH tunnelled SOCKS proxy, set your web browser to use it and you're at least doing your business over an encrypted connection.
Linux Counter-Rant (featuring a sub-rant)
Submitted by shawn on Tue, 08/11/2009 - 01:22Now that some time has passed since that rant I posted (see last post) I'm feeling a little better. Photo editing and management support is really annoying though. I haven't made any ground on what I was annoyed with last time around except that I figured out that Windows Vista Ultimate isn't the best OS to run in vmware because it's such a friggin' hog. XP works nicely as does Windows 7 (which is more awesome than any other Windows ever).
Linux Rant
Submitted by shawn on Fri, 06/19/2009 - 11:43Really the biggest issue I have with Ubuntu Linux right now is photography support. it's scattered and kinda sucky. photography has a workflow to it. you have your app to import and organize your photos. ideally that same app allows you to tag them into "like" and "suck" categories (among others) and it should allow you to edit the images as well. finally that app also needs to have some type of exporting tools that let you pick out your selection of likes and export them out to another location resized, renamed or both.
Radical
Submitted by shawn on Tue, 03/31/2009 - 14:25So if this works I'll get a new tweet, a new blog post and my Facebook will be notified. I'm so "connected".
More SSH fun soon...
Setup an SSH Server and Client on Windows or Linux
Submitted by shawn on Thu, 03/26/2009 - 21:30SSH (secure shell) allows you secure shell access to a server from a client across any network (local or Internet) with the comfort in knowing that your information is secure (even your password used to log in). Everything that travels across a SSH connection is encrypted. Typically you'd use SSH for executing terminal commands at the server (restarting HTTP servers or managing your MySQL server for example) but it also supports port forwarding, tunneling and even file transfers.
