Skip to content

Instantly share code, notes, and snippets.

@lushchick
Created May 16, 2012 07:55
Show Gist options
  • Save lushchick/2708487 to your computer and use it in GitHub Desktop.
Save lushchick/2708487 to your computer and use it in GitHub Desktop.
Bash tricks
#!/bin/bash
# Rename multiple files
for i in *.html; do mv $i ${i%.*}.tpl; done;
# Create file of specified size (1G)
dd if=/dev/zero of=sparse_file bs=1073741824 skip=1073741824 count=1
# Resample images so height and width aren't greater than specified size. Save in thumbnails folder
for i in Photo*.jpg; do sips -Z 100 $i --out thumbnails/${i%.*}_thumb.${i##*.}; done
# Reset VM
VBoxManage controlvm Debian reset
# MacPorts
# set system default PHP version to 5.4
sudo port select --set php php54
# Resume VM
VBoxManage startvm Debian --type headless
# Save VM state
VBoxManage controlvm Debian savestate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment