linux
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
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.
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.
