Skip to content

Instantly share code, notes, and snippets.

View twhite96's full-sized avatar
🫥
suffering from ennui

tiff twhite96

🫥
suffering from ennui
View GitHub Profile
@twhite96
twhite96 / abstact.md
Created January 10, 2025 20:00 — forked from teocci/abstact.md
Signal handling example for golang

Handling Unix Signals In Golang

Unix signals are software interrupts that are sent to a program to indicate that some important event has occurred. The events can vary from user requests to illegal memory access errors. Some signals, such as the interrupt signal, indicate that a user has asked the program to do something, not in the usual control flow.

Dealing with the operating system signals is important for various use cases in applications. For example, we might want a server to gracefully shut down when it receives a SIGTERM, or a command-line tool to stop processing input if it receives a SIGINT. Here’s how to handle signals in Go with channels.

os/signal package

Golang’s os/signal the package allows you to configure the behavior of your Golang program upon receiving certain types of UNIX signals. Most Linux/Unix-based programs will gladly die upon receiving a kill signal, but in case you want your program to intercept the signal first, perform some backup, flush data to disk, etc before dying,

@twhite96
twhite96 / nodejs-cicd-github-actions.md
Created September 16, 2024 02:40 — forked from danielwetan/nodejs-cicd-github-actions.md
Deploy Node.js to VPS using Github Actions

Deploy Node.js to VPS using Github Actions

Steps to deploy Node.js to VPS using PM2 and Github Actions

1. Clone repo to VPS folder

@twhite96
twhite96 / nodejs-cicd-github-actions.md
Created September 16, 2024 02:40 — forked from danielwetan/nodejs-cicd-github-actions.md
Deploy Node.js to VPS using Github Actions

Deploy Node.js to VPS using Github Actions

Steps to deploy Node.js to VPS using PM2 and Github Actions

1. Clone repo to VPS folder

@twhite96
twhite96 / deploy.sh
Created September 16, 2024 02:39 — forked from stancl/deploy.sh
Deploy using GitHub actions and SSH to a VPS
#!/bin/sh
set -e
vendor/bin/phpunit
npm run prod
git add .
(git commit -m "Build frontend assets for deployment to production") || true
(git push) || true
@twhite96
twhite96 / deploy.sh
Created September 16, 2024 02:39 — forked from stancl/deploy.sh
Deploy using GitHub actions and SSH to a VPS
#!/bin/sh
set -e
vendor/bin/phpunit
npm run prod
git add .
(git commit -m "Build frontend assets for deployment to production") || true
(git push) || true
@twhite96
twhite96 / calibre.py
Created September 14, 2024 00:10
Open calibre python script
import os
path = "/Applications/calibre.app"
flags = os.O_RDONLY
mode = 0o666
os.open(path, flags, mode)
@twhite96
twhite96 / _deobfuscating-unminifying-obfuscated-web-app-code.md
Created August 20, 2024 05:26 — forked from 0xdevalias/_deobfuscating-unminifying-obfuscated-web-app-code.md
Some notes and tools for reverse engineering / deobfuscating / unminifying obfuscated web app code
@twhite96
twhite96 / install-qbittorent-web-ui.md
Created August 4, 2024 20:30
How to install qBittorent on Ubuntu Server

To run qBittorent Web Ui Headless, run:

sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable

Then: sudo apt install qbittorrent-nox

Which will give you the web UI at http://localhost:8080

Doing this means you can't run any other commands while running the Web UI.

@twhite96
twhite96 / remove-dates.sh
Created July 11, 2024 11:24
batch remove dates from filenames
function removedates() {
for file in *.md
do mv "${file%%[0-9]*.md} /dates-removed/${file%*.md}"
done
}
@twhite96
twhite96 / convert-to-webp.sh
Created July 11, 2024 11:23
convert all images to webp
function webpall() {
for file in *;
do cwebp -q 50 "$file" -o "${file%.*}.webp";
done
}