Skip to content

Instantly share code, notes, and snippets.

View joshschmelzle's full-sized avatar
👻
༼ つ ◕_◕ ༽つ🛜

jsz joshschmelzle

👻
༼ つ ◕_◕ ༽つ🛜
View GitHub Profile
@joshschmelzle
joshschmelzle / get-output-from-docker.yml
Created November 7, 2024 21:23
Get and use output from docker in GHA
name: Get Output from Docker
on:
workflow_dispatch:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest

macOS/BSD specific

Thanks @seldo and @NurmiWilliam

sudo lsof -iTCP -sTCP:LISTEN -n -P | awk 'NR>1 {print $9, $1, $2}' | sed 's/.*://' | sort -u | while read port process pid; do echo "Port $port: $(ps -p $pid -o command= | sed 's/^-//') (PID: $pid)"; done | sort -n

git-sweep.sh

@joshschmelzle
joshschmelzle / gist:b03964a543e3aa0499a9ec360298878b
Last active November 27, 2023 16:20
Fix flash drive for Windows installation media

Thanks to cereberus on tenforums.com.

Do you have a flash drive that you previously used for a Linux install and now want to use it for a Windows install? Does the flash drive not show up for the Windows installation media? Follow the steps below to wipe the USB flash drive and stage it for Windows.

Open a command prompt/terminal with admin rights and type the following:

diskpart
@joshschmelzle
joshschmelzle / setup.sh
Last active April 28, 2023 21:20
Mac Setup
# create a file on your mac called setup.sh
# run it from terminal with: sh setup.sh
# heavily inspired by https://twitter.com/damcclean
# https://github.com/damcclean/dotfiles/blob/master/install.sh
# inspired by https://gist.github.com/chris-sev/45a92f4356eaf4d68519d396ef42dd99
# faster dock hiding/showing (run in terminal)
# defaults write com.apple.dock autohide-delay -float 0; defaults write com.apple.dock autohide-time-modifier -int 0;killall Dock
@joshschmelzle
joshschmelzle / README.md
Created March 1, 2023 21:03 — forked from nymous/README.md
Logging setup for FastAPI, Uvicorn and Structlog (with Datadog integration)

Logging setup for FastAPI

This logging setup configures Structlog to output pretty logs in development, and JSON log lines in production.

Then, you can use Structlog loggers or standard logging loggers, and they both will be processed by the Structlog pipeline (see the hello() endpoint for reference). That way any log generated by your dependencies will also be processed and enriched, even if they know nothing about Structlog!

Requests are assigned a correlation ID with the asgi-correlation-id middleware (either captured from incoming request or generated on the fly). All logs are linked to the correlation ID, and to the Datadog trace/span if instrumented. This data "global to the request" is stored in context vars, and automatically added to all logs produced during the request thanks to Structlog. You can add to these "global local variables" at any point in an endpoint with `structlog.contextvars.bind_contextvars(custom

@joshschmelzle
joshschmelzle / push-to-someone-elses-pr.md
Created November 4, 2022 02:21 — forked from wtbarnes/push-to-someone-elses-pr.md
Brief instructions for how to modify and push to someone else's PR on github

How to Push to Someone Else's Pull Request

Let's say contributor has submitted a pull request to your (author) project (repo). They have made changes on their branch feature and have proposed to merge this into origin/master, where

origin -> https://github.com/author/repo.git

Now say you would like to make commits to their PR and push those changes. First, add their fork as a remote called

@joshschmelzle
joshschmelzle / iperf3.md
Created September 20, 2022 01:54
iPerf3 systemd.unit

iPerf3 service with systemd

  • Create file at /etc/systemd/system/iperf3.service with contents from iperf3.service

systemctl

  • To start a service at boot, use the enable command: sudo systemctl enable iperf3.service
  • To view the service status, use the status command: sudo systemctl status iperf3.service
  • To start the service, use the start command: sudo systemctl start iperf3.service
  • To stop the service, use the stop command: sudo systemctl stop iperf3.service
@joshschmelzle
joshschmelzle / cisco-scrypt-generator.py
Last active April 1, 2021 12:01
Cisco Scrypt Secret 9 Generator Attempt - YMMV
import base64
import scrypt
import os
import random
# password
password = "hashcat"
# translation table
base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
@joshschmelzle
joshschmelzle / iperf3-server-on-ubuntu.md
Last active October 6, 2020 14:29
iperf3 server install

installing iperf3 and make it start at boot on a ubuntu server.

install iperf3:

sudo apt-get install iperf3

start iperf3 server at startup

@joshschmelzle
joshschmelzle / Remote-PCAP-Daemon.md
Last active December 15, 2021 16:06
WLAN Pi Tricks

Remote PCAP

Requirements:

  • Windows 10, or newer
  • Wireshark 3.0, or newer (installed with Sshdump component)
  • WLAN Pi or SBC (assumption is rpcapd is setup and running)
  • SSH Client

Can leverage rpcap (remote packet capture) protocol supported by Wireshark to capture raw wireless frames from the WLAN NIC used by the WLAN Pi. This can be leveraged to do a packet capture from a WLAN Pi in a remote location.