Skip to content

Instantly share code, notes, and snippets.

@amotmot
Created July 20, 2017 00:45
Show Gist options
  • Save amotmot/b4bbcc3c36c3ea8cd990bdd2d5fafa96 to your computer and use it in GitHub Desktop.
Save amotmot/b4bbcc3c36c3ea8cd990bdd2d5fafa96 to your computer and use it in GitHub Desktop.
#! /bin/bash
## --proxy-server=socks://127.0.0.1:11080
## --proxy-pac-url="http://zap/proxy.pac"
## --proxy-bypass-list="local" \
if [[ -n "$FRESH" ]]; then
UDD="$TMPDIR/chromium-$RANDOM"
ARGS="$ARGS --user-data-dir=$UDD"
fi
ARGS="$ARGS --no-default-browser-check"
ARGS="$ARGS --no-first-run"
ARGS="$ARGS --disable-default-apps"
if [[ -n "$HTTP_PORT" ]]; then
if expr "$HTTP_PORT" : '.*:[0-9][0-9]*' >/dev/null; then
ARGS="$ARGS --proxy-server=http://${HTTP_PORT}"
else
HTTP_HOST=127.0.0.1
ARGS="$ARGS --proxy-server=http://${HTTP_HOST}:${HTTP_PORT}"
fi
else
if [ -n "$SOCKS_PROXY" ]; then
echo "You meant env SOCKS_PORT=$SOCKS_PROXY" >&2
SOCKS_PORT=$SOCKS_PROXY
unset SOCKS_PROXY
fi
if [ -z "$SOCKS_PORT" ]; then
SOCKS_PORT=11080
fi
ARGS="$ARGS --proxy-server=socks5://127.0.0.1:${SOCKS_PORT}"
fi
/Applications/Chromium.app/Contents/MacOS/Chromium \
$ARGS "$@" &
disown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment