Skip to content

Instantly share code, notes, and snippets.

View dillera's full-sized avatar

Andrew Diller dillera

View GitHub Profile
@dillera
dillera / set_iptable_rules.bash
Created June 12, 2024 01:59
A set of commands to setup iptables for the firewall host
cat <<EOF | sudo bash
# Flush existing rules and set default policies
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -t raw -F
iptables -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
@dillera
dillera / udp_capture.py
Created June 7, 2024 14:41
Small Python script to capture UDP traffic and display the payload
import pyshark
import logging
# Set up logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def packet_handler(pkt):
try:
if 'UDP' in pkt:
src_addr = pkt.ip.src
@dillera
dillera / index.html
Created May 22, 2024 02:00
FujiNet Flasher Auto Manifest
cat <<'EOF' > index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ESP Web Tools with Dynamic Manifest</title>
<style>
#spinner {
display: none;
@dillera
dillera / HTTP.cpp
Created May 11, 2024 01:06
refactored http.cpp
NetworkProtocolHTTP::~NetworkProtocolHTTP()
{
for (int i = 0; i < collect_headers_count; i++)
if (collect_headers[i] != nullptr)
{
free(collect_headers[i]);
collect_headers[i] = nullptr;
}
}
@dillera
dillera / create-startup.bash
Created November 22, 2023 20:46
A bash script that will create a systemd startup file using local env vars for security
#!/bin/bash
#
# create flask startup scripts for flask apps.
# a typical path: /home/ubuntu/yourProject
# with a venv at: /home/ubuntu/yourProject/venv
#
# adiller oct 2023
#
#################################################################
# Function to display usage notes
@dillera
dillera / gist:3efa529674685b2d23e996fff29d54cc
Created September 19, 2023 13:52
simple openAI translation service
python3 -m venv venv
source venv/bin/activate
pip install Flask openai
python ./app.py
----------------------------------------------
from flask import Flask, request, jsonify
@dillera
dillera / mastodon_backup.sh
Created December 23, 2022 21:06 — forked from nolanlawson/mastodon_backup.sh
Script to back up a Mastodon instance (for non-dockerized installs)
#!/usr/bin/env bash
#
# Make a backup file of a Mastodon instance. The backup file is a TGZ containing
# the Postgres dump as well as the /public/system (media) files and the
# .env.production file. For loading the dump file contents, see:
# https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Migration-guide.md
#
# Usage: ./mastodon_backup.sh my_dump_file.tgz
#
# Advanced usage: MASTODON_LIVE_DIRECTORY=/path/to/live ./mastodon_backup.sh my_dump_file.tgz
#!/usr/local/bin/bash
# chddeck_osx.sh for Macintosh OSX 2022
# original script from https://www.emudeck.com/ EmuDeck installation.
# https://github.com/dragoonDorise/EmuDeck/blob/main/tools/chdconv/chddeck.sh
# modified to run on a local copy of ROM files to compress them before installing on SteamDeck
#
# N O T E S:
#
# install chdman from brew! You need this for the script to do anything...
'########:'##::::'##:::::::'##:'####:'##::: ##:'########:'########:
##.....:: ##:::: ##::::::: ##:. ##:: ###:: ##: ##.....::... ##..::
##::::::: ##:::: ##::::::: ##:: ##:: ####: ##: ##:::::::::: ##::::
######::: ##:::: ##::::::: ##:: ##:: ## ## ##: ######:::::: ##::::
##...:::: ##:::: ##:'##::: ##:: ##:: ##. ####: ##...::::::: ##::::
##::::::: ##:::: ##: ##::: ##:: ##:: ##:. ###: ##:::::::::: ##::::
##:::::::. #######::. ######::'####: ##::. ##: ########:::: ##::::
..:::::::::.......::::......:::....::..::::..::........:::::..:::::
-----------------------
#!/usr/sgug/bin/bash
# This script should be run as your user!
# Some useful variables
build_progress_dir="/usr/people/edodd/btw/tiny_build/output/PROGRESS"
sgug_rse_srpm_archive_root="/usr/people/edodd/rpmbuild/SRPMS"
sgug_rse_git_root="/usr/people/edodd/btw/tiny_build/sgug-rse.git"
sgug_rse_srpm_output_root="/usr/people/edodd/btw/tiny_build/output/SRPMS"
sgug_rse_rpm_output_root="/usr/people/edodd/btw/tiny_build/output/RPMS"
_rpmbuild=$1
if [[ -z $_rpmbuild ]] ; then