Skip to content

Instantly share code, notes, and snippets.

@ojas
Last active October 5, 2016 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojas/aaf1042146145a3daa80 to your computer and use it in GitHub Desktop.
Save ojas/aaf1042146145a3daa80 to your computer and use it in GitHub Desktop.
Mac Tips

How to find what program's running on a given port

See what's running on port 80

sudo lsof -i :80

Restart Audio

sudo kill -9 `ps ax|grep 'coreaudio[a-z]' |awk '{print $1}'`

Flush DNS Cache

## Mavericks

dscacheutil -flushcache
sudo killall -HUP mDNSResponder


## Lion or Mountain Lion

sudo killall -HUP mDNSResponder

## Mac OS X v10.6

sudo dscacheutil -flushcache

Clipboard image to Embedded HTML (via Data URI)

Get pngpaste, then…

pngpaste - | base64 | awk '{print "<img src=\"data:image/png;base64,"$1"\">"}' | pbcopy

Convert movie to GIF

ffmpeg -i my-movie.mov -s 800x600 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=10 > my-movie.gif

See OS X Screencast to animated GIF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment