Skip to content

Instantly share code, notes, and snippets.

View acceptableEngineering's full-sized avatar
:octocat:

Mark Mutti acceptableEngineering

:octocat:
View GitHub Profile

SysOps Tricks

LOG Traffic with iptables

Specific IP:

Replace SOURCE_IP with an actual CIDR range (0.0.0.0/0 for all)

sudo iptables -I INPUT -s SOURCE_IP -j LOG --log-prefix "SOME_LABEL_HERE-INPUT: "
sudo iptables -I FORWARD -s SOURCE_IP -j LOG --log-prefix "SOME_LABEL_HERE-FORWARD: "
sudo iptables -I OUTPUT -d SOURCE_IP -j LOG --log-prefix "SOME_LABEL_HERE-OUTPUT: "
#!/bin/bash
SPEEDTEST=$(/opt/homebrew/bin/speedtest -I en0 -f json)
RESULT=$(echo $SPEEDTEST | /opt/homebrew/bin/jq '.download.bandwidth')
/usr/local/bin/aws cloudwatch put-metric-data --namespace "The Eyeris" --metric-name SpeedTest-Download --value ${RESULT} --region us-west-2
RESULT=$(echo $SPEEDTEST | /opt/homebrew/bin/jq '.upload.bandwidth')
/usr/local/bin/aws cloudwatch put-metric-data --namespace "The Eyeris" --metric-name SpeedTest-Upload --value ${RESULT} --region us-west-2
RESULT=$(echo $SPEEDTEST | /opt/homebrew/bin/jq '.ping.latency')
/usr/local/bin/aws cloudwatch put-metric-data --namespace "The Eyeris" --metric-name SpeedTest-Ping --value ${RESULT} --region us-west-2
RESULT=$(echo $SPEEDTEST | /opt/homebrew/bin/jq '.packetLoss')
#!/bin/bash
RESULT=$(/sbin/ping -s 1 -i 0.2 -c 20 8.8.8.8 | grep "packet loss" | /usr/bin/awk -F ',' '{print $3}' | awk '{print $1}' | /usr/bin/sed 's/%//')
/usr/local/bin/aws cloudwatch put-metric-data --namespace "The Eyeris" --metric-name Outgoing-Ping-Loss --value ${RESULT} --region us-west-2
RESULT=$(/sbin/ping -s 1 -i 0.2 -c 20 10.10.0.1 | grep "packet loss" | /usr/bin/awk -F ',' '{print $3}' | awk '{print $1}' | /usr/bin/sed 's/%//')
/usr/local/bin/aws cloudwatch put-metric-data --namespace "The Eyeris" --metric-name Internal-Ping-Loss --value ${RESULT} --region us-west-2

SSL

Lookup an SSL certificate (for any service/port)

$ DOMAIN=www.shoutdrive.com && echo | openssl s_client -showcerts -servername ${DOMAIN} -connect ${DOMAIN}:443 2>/dev/null | openssl x509 -inform pem -noout -text

Mount a Remote Service Locally

$ ssh -L 15672:localhost:15672 user@remoteHost
@acceptableEngineering
acceptableEngineering / Video-Engineering-Tricks.md
Last active July 13, 2024 17:44
Video Engineering (Command Line) Tricks

Description

These are commands I use on a regular basis. For the sake of simplicity, the filenames I use in the examples below are in.mp4 and out.mp4, though you can use your imagination to picture blah.mov or audio.wav on a case-by-case basis.


FFmpeg

Media Conversion