Evan’s posterous

Adventures in pomodoro and other such things 
Filed under

mac

 

snow leopard screen saver password delay

use the following to set the time between when screen saver activates and when a password is required to access the computer, the time is in seconds (10 in this case)

defaults -currentHost write com.apple.screensaver askForPasswordDelay -int 10

Filed under  //   mac  

Comments [0]

creating a bootable usb drive from a .img file on OSX

From https://help.ubuntu.com/community/Installation/FromImgFiles:

  • Download the desired .img file
  • Open a Terminal (under Utilities)
  • Run diskutil list to get the current list of devices
  • Insert your flash media
  • Run diskutil list again and determine the device node assigned to your flash media (e.g. /dev/disk2)
  • Run diskutil unmountDisk /dev/diskN (replace N with the disk number from the last command; in the previous example, N would be 2)
  • Execute sudo dd if=/path/to/downloaded.img of=/dev/diskN bs=1m (replace /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.img). If you see the error dd: Invalid number `1m', you are using GNU dd. Use the same command but replace bs=1m with bs=1M.
  • Run diskutil eject /dev/diskN and remove your flash media when the command completes

Filed under  //   img   mac   usb  

Comments [0]

copying files with rsync

rsync is a great way to copy files between computers as it can continue after partial copies and update directories when only a few files have changed, it also supports secure file copies over ssh as shown below:

copy files locally:

rsync -rtvzP --delete --exclude=.Trash /Users/evan/ /Volumes/backup/evan/

copy local files to a remote computer excluding all the mac .DS_Store folders in the path:

rsync -ravzP --exclude=**/.DS_Store -e ssh "/Users/evan/my files/" evan@someserver.codepit.ca:/home/evan/files/

copy remote files onto a local computer:

rsync -ravzP -e ssh 10.10.238.123:"/home/evan/my files/" /Users/evan/files/

NOTE the use of " when there is are spaces in the file paths

Useful switches:

-n == dry run, very useful with --delete :o
--delete == delete files when they are missing from the source computer and present on the target

Filed under  //   linux   mac  

Comments [0]

flushing mac dns cache

dscacheutil -flushcache

Filed under  //   mac  

Comments [0]

setting Bing as your default Safari search engine

Download Glaims (http://www.macupdate.com/info.php/id/27708/glims) 

Quit Safari
 
Run the Glaims installer
 
Restart Safari
 
Open the Safari preferences and click the "Glims", click "Search Engines" and "add" a new entry
 
Name it "Bing" and enter the Query URL "http://www.bing.com/search?q=#query#"
 
Click Add/Set

Close Safari preferences
 
Change the search engine in Safari by clicking on Google icon in the search box and select Bing
 
Enjoy!

Filed under  //   mac  

Comments [3]

how to uninstall Inquisitor from Safari

To uninstall the Inquisitor search (http://www.inquisitorx.com/safari/index_en.php) plugin from safari issue the following commands on the command line:

sudo rm -Rf /Library/InputManagers/Inquisitor/
sudo rm -rf /Library/Receipts/inquisitor*
rm -Rf ~/Library/Application\ Support/Inquisitor/

Quit and restart Safari

Filed under  //   mac  

Comments [0]

create md5 hash files for a maven repo

Use this command to generate .md5 hash files for all of the libraries in your maven repository, on mac:

find -E . -regex ".*(\.jar|\.pom)$" -exec sh -c "/sbin/md5 -q '{}' > '{}.md5'" \;

on linux try this:

find . -regextype posix-extended -regex ".*(\.jar|\.pom)$" -exec sh -c "/usr/bin/md5sum '{}' > '{}.md5'" \;

Filed under  //   linux   mac   maven  

Comments [0]