Skip to content

Instantly share code, notes, and snippets.

View hebrides's full-sized avatar
🚀
Building Rocket Ships

SMGMobile - Marcus hebrides

🚀
Building Rocket Ships
View GitHub Profile
@hebrides
hebrides / rnd.sh
Created February 5, 2022 17:10
Generate random alphanumeric text DIGITS long.
#!/bin/bash
# This is a simplified version of this script: https://gist.github.com/earthgecko/3089509
# "Random numbers in a range, more randomly distributed than $RANDOM
# which is not very random in terms of distribution of numbers."
# You may want to add a reference to your .bashrc file, e.g.:
# alias rnd="path/to/script/rnd.sh"
@hebrides
hebrides / quick_deny_bot_attacks.sh
Last active February 23, 2022 04:57
Parse nginx error logs to find then deny suspicious IPs
#!bin/bash
# The first script (I) will show you locations of the bot servers / proxies.
# The second (II) denies access.
# NOTE: Use an automated service like fail2ban before using these scripts.
# These are handy for bots that slip through the cracks.
#
# Ref: https://stackoverflow.com/questions/67812746/someone-made-some-wp-wlwmanifest-xml-http-requests-but-why
@hebrides
hebrides / ocr.sh
Last active December 11, 2022 02:47
PDF to CSV
#!bin/bash
# A bit of a hack... useful for old bank docs and PDFs as a
# first step to converting to CSV before importing to a
# spreadsheet or accounting application
# Requires Imagemagick and Tesseract:
# brew install imagemagick
# brew install tesseract
@hebrides
hebrides / ffmpeg_resize_reduce_audio.sh
Last active December 11, 2022 03:00
Video Compressor
# From: https://stackoverflow.com/questions/29082422/ffmpeg-video-compression-specific-file-size
# Here's a way to do it automatically with a bash script
# Just call like ./script.sh file.mp4 15 for 15mB
# Audio Bitrate is 64k
# TODO: Write a simple wrapper, make audio variable / add controls
bitrate="$(awk "BEGIN {print int($2 * 1024 * 1024 * 8 / $(ffprobe \
-v error \
-show_entries format=duration \