Skip to content

Instantly share code, notes, and snippets.

View bashtheshell's full-sized avatar

Travis Johnson bashtheshell

  • Western NY
View GitHub Profile
@bashtheshell
bashtheshell / rpi-imager-cli_macOS_tutorial.md
Last active July 19, 2023 00:34
Brief tutorial on how to use Raspberry Pi Imager `rpi-imager --cli` command on macOS to be able to automate image re-creation.

How to Use Raspberry Pi's rpi-imager --cli Command on macOS

With the modern rpi-imager tool, we can automate the imaging process for the Raspberry Pi computer board and make the process extremely painless for us each time we need to re-image.

The official Raspberry Pi's rpi-imager's tool (which can be installed from https://www.raspberrypi.com/software/) contains a command-line option that's not widely documented anywhere at the time of this writing (v1.7.5 was the latest release).

The best official documentation I can possibly find on Raspberry Pi Imager did not cover the command-line option.

As a result, I'll only cover the command-line option for macOS here as it's my daily driver.

@bashtheshell
bashtheshell / iptables-A_INPUT-translate.py
Last active May 15, 2023 17:22
Translate manually-written '-A INPUT' lines in 'rules.v4' iptables file to the format identical to `iptables -S` output.
#!/usr/bin/env python3
# The purpose of this program is to only slightly modify and rearrange all 'A-INPUT' arguments, that may be manually written to the `iptables`'s `rules.v4`
# file, in the order that the `iptables -S` command uses. This would allow one to see less lines when using `diff` command to compare
# the newly-translated output from this program with `iptables -S` output. Ideally, you should not find any '-A INPUT' in the `diff` output. Otherwise, there
# may have been a bug with the program (e.g. some strings elude the regular expression pattern). Please remember that lines beginning with comment ('#')
# are ignored.
# USAGE:
# You can either give it a file as its argument or pass a file to the program using STDIN. Here are few ways:
@bashtheshell
bashtheshell / handbrake_automated_conversion_whole_dvd_to_individual_m4v_chapter_files.md
Created July 2, 2022 19:04
HandBrake Automated Conversion - Whole DVD to Individual M4V Chapter Files

HandBrake Automated Conversion - Whole DVD to Individual M4V Chapter Files

As the title suggested, HandBrake can be used to extract chapters from the DVD movie (assuming only one title exists on DVD) and write them to the data storage in M4V format using HandBrake's default preset, Fast 1080p30.

By default, HandBrake would copy the entire DVD and write them to a single M4V file. I've developed a wrapper script, leveraging the HandBrakeCLI command to perform the automation of reading a specific chapter from the DVD and writing it to an .m4v file.

The files would be written in a directory named after the filename of a required chapter markers file, which

@bashtheshell
bashtheshell / create_clover_bootloader_usb_macos.md
Last active April 20, 2024 18:17
Guide on Creating Clover Bootloader USB on macOS - useful for users with PCIe NVMe SSDs installed on Legacy BIOS machines.

How to Create Clover Bootloader USB on macOS (for PCIe NVMe SSD booting on Legacy BIOS system):

SUMMARY:

If you are a macOS user like me, and you want to create a Clover Bootloader USB on it just so that you can boot up the operating systems that are installed on PCIe NVMe SSDs on your archaic hardware using legacy BIOS? Then you've come to the right place. You may be a homelabber like myself wanting to boot up the hypervisor (e.g. Proxmox).

I've spent numerous hours, searching for a clear step-to-step guide on this, and apparently there isn't an easily-searchable one for macOS users at the time of this writing. Fortunately for us, the Clover project, hosted on GitHub, has a convenient package for us to create a bootloader USB. This project is also hosted on SourceForge.

DOWNLOADING CLOVER:

@bashtheshell
bashtheshell / slack_app_installer_homedir_macOS.md
Last active December 15, 2023 18:51
Install Slack app in User's ~/Applications directory - macOS

Install Slack app in User's Applications Directory - macOS

Background

This work was inspired by the challenges I encountered in the workplace. I manage several macOS remotely, and one of the biggest pains is that our users aren't administrators on those machines. Thus, they aren't able to dismiss the Squirrel Update prompts on their own, which was a productivity hindrance.

Initially as a fun side-project to satisfy my curiosity, I came up with a solution to mitigate this by having the Slack app, which was already installed in the main /Applications directory, automatically update itself as soon as the Launch Daemon script fetches a new update from slack.com. The script would notify all users actively using Slack that the app would restart itself in several seconds.

Admittedly, the above solution wasn't organic and understandably it can be a grave security concern for some. The only upside of

@bashtheshell
bashtheshell / python3_virtualenv_tips.md
Created July 13, 2020 00:10
A quick primer on setting up virtual environment with Python 3

Python3 Virtual Environment Cheat Sheet:

Oftentimes, I'd forget how to set up a quick virtual environment (virtualenv) with Python3 when I'd find myself working on a new Python script after months of inactivity.

Before running the command below, it's assumed you have Python 3 already installed and you're in a new directory. In this example, we'll use project_dir as a new directory which is located in the current user's home directory.

mkdir ~/project_dir
cd ~/project_dir
python3 -m venv venv
@bashtheshell
bashtheshell / sipp-ring-trigger-VP.md
Last active February 27, 2019 09:40
SIPp Ring Trigger for Videotelephony App

Videotelephony Ring Trigger


Purpose

The ultimate goal of this "ring trigger" guide is to test the videotelephony SIP-based client to see if it is actively listening on local socket. The client should ring continuously upon command execution. The tool used in this guide is simply a preexisting SIPp command, and we're going to take a narrow focus on only using the SIP INVITE request rather than the entire SIP handshake sequence.

Disclaimer: All information and software available on this guide are for educational purposes only. Use these at your own discretion, the author cannot be held responsible for any damages caused. Usage of all tools on this guide for attacking targets without prior mutual consent is illegal. It is the end user’s responsibility to obey all applicable local, state and federal laws. The author assumes no liability and is not responsible for any misuse or damage caused by this guide.

Quick Peak