Skip to content

Instantly share code, notes, and snippets.

@gregjhogan
gregjhogan / pip-downgrade.sh
Created October 18, 2018 22:00
downgrade pip to a specific version
sudo python -m pip install pip==18.0 --upgrade
@gregjhogan
gregjhogan / eth-negotiated-speed.sh
Created October 16, 2018 00:05
check ethernet negotiated speed
sudo ethtool eth0 | grep Speed
hostnamectl set-hostname NEW_NAME_HERE
@gregjhogan
gregjhogan / files-deleted-but-still-referenced.sh
Created August 19, 2018 21:12
files deleted but still referenced
lsof -nP +L1
@gregjhogan
gregjhogan / az-cli-mitmproxy.sh
Created August 19, 2018 20:48
azure cli through mtimproxy
REQUESTS_CA_BUNDLE=~/.mitmproxy/mitmproxy-ca-cert.cer HTTPS_PROXY=http://localhost:8080 az "$@"
@gregjhogan
gregjhogan / mitmproxy-local-proxy.sh
Last active June 21, 2023 21:24
setup mitmproxy local proxy for inspecting traffic
#!/bin/bash -ex
# first go to http://mitm.it/ and follow instructions
# then got to chrome://settings/certificates -> Authorities and import: ~/.mitmproxy/mitmproxy-ca-cert.pem
docker run --rm -it -v ~/.mitmproxy:/home/mitmproxy/.mitmproxy -p 8080:8080 -p 127.0.0.1:8081:8081 mitmproxy/mitmproxy mitmweb --web-host 0.0.0.0
@gregjhogan
gregjhogan / delete-broken-links.sh
Last active July 26, 2018 21:50
delete broken links
@gregjhogan
gregjhogan / delete-files-older-than-date.sh
Created July 25, 2018 23:52
delete files older than a date
find /path/to/dir ! -newermt 2018-01-01 ! -type d -delete
@gregjhogan
gregjhogan / python-fork-skip-finally.py
Last active July 5, 2018 19:18
python fork and skip finally blocks
import os
try:
child_pid = os.fork()
if child_pid == 0:
# finally block runs twice
#exit(1)
# finally block runs once on exception
#try:
# raise Exception('bang!')
@gregjhogan
gregjhogan / hdd-blink.sh
Created July 2, 2018 20:49
make hard drive lights blink