# brew install squid2
# vim /usr/local/Cellar/squid2/2.7.9/etc/squid.conf
Mac Network Commands Cheat Sheet | |
After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Good luck out there, and stay salty. | |
Get an ip address for en0: | |
ipconfig getifaddr en0 | |
Same thing, but setting and echoing a variable: |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Pdfcrop | |
======= | |
Based on pdfcrop.pl_. Uses the BoundingBox [#]_ | |
Dependencies: | |
- PyPDF2_ |
#!/usr/bin/env bash | |
set -euo pipefail | |
origdir=$(pwd) | |
tmpdir=$(mktemp -d) | |
echo "tmpdir: $tmpdir" | |
read -r width height < <(pdfinfo $1 | grep "Page size:" | sed 's/[a-zA-Z: ]*\([0-9]\+\)[x ]*\([0-9]\+\).*/\1 \2/') | |
npages=$(pdfinfo $1 | grep "Pages:" | sed 's/Pages: \+\([0-9]\+\).*/\1/') | |
echo "page count: $npages" | |
echo "(width, height) = ($width, $height)" |
#!/usr/bin/env bash | |
set -e | |
function yesno() { | |
read -p "$1 Continue? (y/n): " | |
case $(echo -e "$REPLY" | tr '[A-Z]' '[a-z]') in | |
y|yes) echo "yes" ;; | |
*) echo "no" ;; | |
esac |