Skip to content

Instantly share code, notes, and snippets.

View chromestone's full-sized avatar

Derek Zhang chromestone

View GitHub Profile
@chromestone
chromestone / unzip.sh
Created September 10, 2023 16:56
no unzip but have Python? don't download bloat just use ZipFile
#!/usr/bin/env bash
python3 -c "`echo -e 'import sys\nfrom zipfile import ZipFile\nwith ZipFile(sys.argv[1]) as zp:\n\tzp.extractall(".")'`" $1
@chromestone
chromestone / har_replay.py
Created January 11, 2022 20:47
This is an addon for the mitmproxy. https://mitmproxy.org
"""HAR Replay Addon.
This is an addon for the mitmproxy.
See https://mitmproxy.org.
You can get a HAR file using Google Chrome DevTools.
Before navigating to the site, open the network activity inspector.
Then after loading the site completely, you can right click the inspector and save all to a HAR.
Currently there is no support for binary files. Also, only text and base64 encodings are handled by my code.
HAR replay can be used when the JavaScript is server agnostic and only needs to load static content.
@chromestone
chromestone / analyze.sh
Last active July 27, 2020 15:46
Skip command in loop by wrapping and piping stderr to a custom killer script
#!/bin/bash
while read line
do
# use =~ for extended regex
if [[ "$line" == "bad" ]]; then
echo "KILLED"
pkill -g 0
fi
@chromestone
chromestone / analyze.sh
Created July 27, 2020 00:39
Skip command in loop by wrapping and piping to a custom killer script
#!/bin/bash
while read line
do
# use =~ for extended regex
if [[ "$line" == "bad" ]]; then
echo "KILLED"
pkill -g 0
fi
@chromestone
chromestone / ram_disk.sh
Last active February 20, 2022 18:47
macOS RAM disk script
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "input some size";
exit 1;
fi
re='^[0-9]+$'
if ! [[ $1 =~ $re ]];
@chromestone
chromestone / README.md
Last active March 21, 2019 23:04
Python script for AWS Lambda. Triggered by SES events. Forwards incoming emails written to S3 back through SES.