Skip to content

Instantly share code, notes, and snippets.

@tobym
tobym / pwdx_for_mac.bash
Created October 27, 2010 01:03
pwdx for mac. Usage: pwx pid
function pwdx {
lsof -a -p $1 -d cwd -n | tail -1 | awk '{print $NF}'
}
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@newfront
newfront / x264 encoding options
Created March 17, 2011 21:01
x264 --fullhelp
Syntax: x264 [options] -o outfile infile [widthxheight]
Infile can be raw YUV 4:2:0 (in which case resolution is required),
or YUV4MPEG 4:2:0 (*.y4m),
or Avisynth if compiled with support (no).
or libav* formats if compiled with lavf support (no) or ffms support (no).
Outfile type is selected by filename:
.264 -> Raw bytestream
.mkv -> Matroska
.flv -> Flash Video
@advorak
advorak / appify.sh
Created November 29, 2011 02:43 — forked from mathiasbynens/appify
appify — create the simplest possible Mac app from a shell script (adds an application icon)
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" ]; then cat <<EOF
appify v3.0.0 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@MatthewEppelsheimer
MatthewEppelsheimer / hack.sh
Created March 31, 2012 23:00 — forked from erikh/hack.sh
OSX Settings
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2269385/a714e0e69ba99936f914ade0083709dcca6f8438/hack.sh | sh
#
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 1, 2024 03:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@welldan97
welldan97 / system-wide-clipboard.zsh
Created March 10, 2013 09:51
Zsh copy & paste system wide for OS X, like in emacs
pb-kill-line () {
zle kill-line
echo -n $CUTBUFFER | pbcopy
}
pb-kill-whole-line () {
zle kill-whole-line
echo -n $CUTBUFFER | pbcopy
}
@vitorgalvao
vitorgalvao / Get Title and URL.applescript
Last active April 3, 2024 02:25
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Webkit variants include "Safari", "Webkit", "Orion".
-- Specific editions are valid, including "Safari Technology Preview".
-- "Safari" Example:
tell application "Safari" to return name of front document
@guifromrio
guifromrio / compress-pdf-with-gs.md
Created August 30, 2013 14:39
Compress PDF files with ghostscript

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
@sergiitk
sergiitk / osx-terminal.md
Last active March 8, 2024 10:32
OSX terminal tips an tricks

OS X terminal tips an tricks

Shell tools

System

  • sw_vers — Print Mac OS X operating system version information
  • system_profiler — Reports system hardware and software configuration.
  • system_profiler SPHardwareDataType — Hardware overview.
  • hostinfo — Host information.
  • nvram -p — Print all of the firmware variables.
  • getconf DARWIN_USER_CACHE_DIR — Retrieve standard configuration variables
  • /usr/libexec/path_helper — Helper for constructing PATH environment variable