Showing posts with label osx. Show all posts
Showing posts with label osx. Show all posts
Sunday, October 20, 2013
Saturday, July 14, 2012
Using pasteboard from command line on OSX
pbcopy, pbpaste - provide copying and pasting to the pasteboard (the Clipboard) from command line.
Here are few examples
Thursday, December 22, 2011
Tuesday, September 27, 2011
Simulating slow network connection in OSX
Setup
Remove
sudo ipfw pipe 1 config bw 16Kbit/s delay 350mssudo ipfw add 1 pipe 1 src-port 80sudo ipfw add 2 pipe 1 dst-port 80Remove
sudo ipfw delete 1sudo ipfw delete 2sudo ipfw pipe 1 delete
Tuesday, July 5, 2011
Resize and position windows with AppleScript
-- get the dimensions of the desktop, set up few variables
tell application "Finder"
set displayAreaDimensions to bounds of window of desktop
set x1 to item 1 of displayAreaDimensions
set y1 to item 2 of displayAreaDimensions
set x2 to item 3 of displayAreaDimensions
set y2 to item 4 of displayAreaDimensions
end tell
set width to x2 - x1
set height to y2 - y1
-- positioning iTunes, make it fullscreen
tell application "iTunes"
set the bounds of the first window to {x1, y1, x2, y2}
end tell
-- positioning Safari, halfwidth on the right
tell application "Safari"
set the bounds of the first window to {x1 + width / 2, y1, x2, y2}
end tell
-- positioning iTerm
tell application "iTerm"
set the bounds of the first window to {x1, y1, x1 + 1000, y1 + 600}
end tell
There are few useful blogposts about the topic.
www.ithug.com/2007/09/applescript-moving-and-resizing-windows or
www.ithug.com/2008/12/applescript-arranging-multiple-windows/
or you can use Divvy, which is an amazing window management app.
Monday, May 30, 2011
useful iterm2 shortcuts
iTerm2 is a good replacement for Terminal on OS X
Splitting the window: Command+D to split the window vertically, or Command+Shift+D to split the window horizontally.
Switching between the sub-windows: Command+[ or Command+] or Command+Opt+arrows
Fullscreen: Command+Enter
Splitting the window: Command+D to split the window vertically, or Command+Shift+D to split the window horizontally.
Switching between the sub-windows: Command+[ or Command+] or Command+Opt+arrows
Fullscreen: Command+Enter
Saturday, March 5, 2011
md5sum on Snow Leopard
The MD5 hash (or checksum) functions as a compact digital fingerprint of a file.
You can check the md5 hash of a file with the md5 command
The output looks like this
MD5 (test.txt) = ab41fdba223f971be13b1845122353cb
You can check the md5 hash of a file with the md5 command
md5 test.txtThe output looks like this
MD5 (test.txt) = ab41fdba223f971be13b1845122353cb
Wednesday, February 9, 2011
Get folder size on OSX
Haruka had this problem, here is a simple solution
du (abbreviated from disk usage) is a standard Unix program used to estimate the file space usage—space used under a particular directory or files on a file system.
du -sh FOLDER_NAMEdu (abbreviated from disk usage) is a standard Unix program used to estimate the file space usage—space used under a particular directory or files on a file system.
Monday, February 7, 2011
Apache on Snow Leopard, "ulimit: open files: cannot modify limit: Invalid argument"
When I started apache on my Snow Leopard i got a weird exception
So I opened the script and found that there is something wrong with $ULIMIT_MAX_FILES
The error message says that 'cannot modify limit' so i changed its value to empty string
Voila, it works, but deeper investigation need.
/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument
So I opened the script and found that there is something wrong with $ULIMIT_MAX_FILES
The error message says that 'cannot modify limit' so i changed its value to empty string
# ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
ULIMIT_MAX_FILES=""
Voila, it works, but deeper investigation need.
Labels:
apache,
command line,
osx,
snow leopard
Saturday, February 5, 2011
Finder shortcuts
Today I realized that i don't know enough Finder shortcuts, here you are.
Command-A Select All Items
Command-C Copy Selected Items
Command-D Duplicate Selected Items
Command-F Search with Spotlight
Command-H Hide Window
Command-I Open Get Info (Property) Pane
Command-M Minimize Window
Command-N Open New Window
Command-O Open Selected Items
Command-V Paste Items
Command-W Close Finder Window
Command-1 View as Icons
Command-2 View as Lists
Command-3 View as Columns
Command-4 View as Coverflow
Command-Shift-A Go to Application Folder
Command-Shift-H Go to Home Folder
Command-Shift-N Create New Folder
Command-Option-O Open File and Close Finder
Command-A Select All Items
Command-C Copy Selected Items
Command-D Duplicate Selected Items
Command-F Search with Spotlight
Command-H Hide Window
Command-I Open Get Info (Property) Pane
Command-M Minimize Window
Command-N Open New Window
Command-O Open Selected Items
Command-V Paste Items
Command-W Close Finder Window
Command-1 View as Icons
Command-2 View as Lists
Command-3 View as Columns
Command-4 View as Coverflow
Command-Shift-A Go to Application Folder
Command-Shift-H Go to Home Folder
Command-Shift-N Create New Folder
Command-Option-O Open File and Close Finder
Friday, January 28, 2011
Changing the default style in Kod
Kod is a promising text editor for OS X.
One of the great things is that, you can style the editor with CSS.
then don't forget to reload the style in Kod, View menu/Reload style
One of the great things is that, you can style the editor with CSS.
mkdir ~/.kod
cp /Applications/Kod.app/Contents/Resources/style/default.css ~/.kod/
defaults write se.hunch.kod style/url ~/.kod/default.css
kod ~/.kod/default.css
then don't forget to reload the style in Kod, View menu/Reload style
Tuesday, December 21, 2010
snoop file opens on Snow Leopard
Opensnoop tracks file opens.
or you can watch only a process
sudo opensnoopor you can watch only a process
sudo opensnoop -n Google Chrome
Labels:
dtrace,
filesystem,
mac,
opensnoop,
osx
Wednesday, June 16, 2010
What changed in your home folder today.
You can perform a simple Spotlight search from the shell
mdfind [query]
for instance
and then you pipe the result as you want
You can redefine your search by specifying any of the metadata attribute keys.
Here is a helpful list of metadata attributes that you can use.
You'd like to see what changed in your home directory today, easy.
mdfind [query]
for instance
mdfind Ruby
mdfind -name stdlib.h
and then you pipe the result as you want
mdfind Ruby | grep 'pdf'
You can redefine your search by specifying any of the metadata attribute keys.
Here is a helpful list of metadata attributes that you can use.
You'd like to see what changed in your home directory today, easy.
mdfind -onlyin ~/ '(kMDItemFSContentChangeDate >= $time.today)'
Tuesday, June 15, 2010
Monitoring file system activity on OS X
My hard disk is quite slow, so It seemed a good idea to see what's going on under the hood, why the filesystem is so busy.
I came across fslogger, which is a great user-space program that subscribes to the kernel's file system change notification service.
Sounds great and actually monitoring file system activity with fslogger is quite easy. It must be run as root but that's it.
The output is little bit verbose but you can cut it with awk.
Helpful.
I came across fslogger, which is a great user-space program that subscribes to the kernel's file system change notification service.
Sounds great and actually monitoring file system activity with fslogger is quite easy. It must be run as root but that's it.
The output is little bit verbose but you can cut it with awk.
# changed files
sudo fslogger | awk '/FSE_ARG_STRING/ { print $5 }'
# file change type
sudo fslogger | awk '/type.*=/ { print $3 }'
# process that caused the change
sudo fslogger | awk '/pid.*=.*\(.*\)/ { print $4$5 }'
Helpful.
Labels:
bash,
command line,
filesystem,
mac,
osx
Subscribe to:
Posts (Atom)