Skip to content

Instantly share code, notes, and snippets.

@tyzbit
tyzbit / custom_host_lua_script.lua
Last active June 27, 2023 23:58
OPNSense ntopng call webhook when in a Google Meet
-- /usr/local/share/ntopng/scripts/callbacks/checks/hosts/custom_host_lua_script.lua
if (host.name() == "meet.google.com") then
local response, err = ntop.httpGet("https://home-assistant-url/api/webhook/webhook-url")
if err then
print("Webhook request for meet.google.com match failed: " .. err)
end
print("Active Google Meet in progress")
end
-- IMPORTANT: do not forget this return at the end of the script
@tyzbit
tyzbit / rprompt.zsh
Last active April 15, 2023 23:27
zsh RPROMPT with execution time and current time on the right hand side
# refreshes the prompt every $TMOUT seconds
TMOUT=15
function preexec() {
timer=$(($(date +%s%0N)/1000000))
}
function precmd() {
if [ $timer ]; then
now=$(($(date +%s%0N)/1000000))
@tyzbit
tyzbit / Shotcut APNG Preset
Last active February 17, 2023 04:47
Shotcut APNG Settings (For creating animated Discord stickers)
audio_off=1
f=apng
an=1
vcodec=apng
width=320
height=320
aspect=1
progressive=1
frame_rate_num=3000000
frame_rate_den=1000000
@tyzbit
tyzbit / zoom-mute-status.scpt
Created September 14, 2019 17:11
Get Zoom Mute/Unmute Status
property btnTitle : "Mute audio"
tell application "System Events" to tell application process "zoom.us"
if exists (menu item btnTitle of menu 1 of menu bar item "Meeting" of menu bar 1) then
do shell script "echo Unmuted"
else
do shell script "echo Muted"
end if
end tell
@tyzbit
tyzbit / kubeproxy.sh
Created October 22, 2022 00:47
Kube Proxy - Use a Kubernetes cluster to proxy out to somewhere else
function kubeproxy() {
setopt local_traps
pod_name="socat-$(whoami)"
if [[ "${2}x" == "x" ]]; then
echo "Usage: kubeproxy [Hostname] [Port]"
return 0
fi
if kubectl run --restart=Never --image=alpine/socat $pod_name -- -d -d tcp-listen:$2,fork,reuseaddr tcp-connect:$1:$2; then
while [[ $(kubectl get pod $pod_name -o json | jq -r '.status.phase') != "Running" ]]; do
sleep 0.1
@tyzbit
tyzbit / configmap.yaml
Last active October 15, 2022 23:58
How to mount configmap
apiVersion: v1
kind: ConfigMap
metadata:
name: file
namespace: default
data:
mycoolfile.txt: |
hey check out my cool file
@tyzbit
tyzbit / Feeds.opml
Created August 30, 2022 15:56
My RSS Feeds
<?xml version="1.0" encoding="UTF-8"?>
<opml version="2.0">
<head>
<title>Feeds</title>
</head>
<body>
<outline text="Anime" title="Anime">
<outline title="Anime News Network - News" htmlUrl="https://www.animenewsnetwork.com/news/" text="Anime News Network - News" type="rss" xmlUrl="https://www.animenewsnetwork.com/news/rss.xml?ann-edition=us" />
</outline>
<outline text="Crypto" title="Crypto">
@tyzbit
tyzbit / ginjson.go
Last active May 3, 2022 23:58
Gin JSON Formatter
func GinJSONFormatter(param gin.LogFormatterParams) string {
jsonFormat := `{"time":"%s","clientip":"%s","method":"%s","uri":"%s","status":%3d,"latency":"%v","message":"%s","host":"%s","useragent":"%s","proto":"%s","error_msg":"%s","size":%d}` + "\n"
return fmt.Sprintf(jsonFormat,
param.TimeStamp.Format(TimeFormatter),
param.ClientIP,
param.Method,
param.Request.RequestURI,
param.StatusCode,
param.Latency,
fmt.Sprintf("%s %s %s", param.Method, param.Request.URL, param.Request.Proto),
@tyzbit
tyzbit / download-video-from-clipboard.sh
Last active April 27, 2022 02:13
Download a video from a URL in clipboard automatically (bind to keyboard shortcut) (Mac/Linux)
#!/bin/bash
dir="$HOME/Videos"
opts="--add-metadata --no-mtime"
if [ -f /usr/local/bin/youtube-dl ]; then
youtube_dl="/usr/local/bin/youtube-dl"
else
youtube_dl="$(which youtube-dl)"
fi
@tyzbit
tyzbit / tylertios_hot_sauces.md
Last active April 17, 2022 16:49
Tylertio's Hot Sauce Reviews

Tylertio's Hot Sauce Reviews


Hot sauces I like and would buy again


Iris Lune | Eclipse Hot Sauce ⭐️⭐️⭐️⭐️⭐️

Brooklyn alt-pop band Iris Lune (featuring HEATONIST's own Aaron Liao) teamed up with the Ontario hot sauce gurus at Dawson’s Hot Sauce for this peachy concoction. The heavier consistency and perfect blend of sweetness and mild heat make Eclipse great with salads, eggs, fried chicken, and even cheesecake. Enjoy while grooving out to Iris Lune’s equally spicy and flavorful music here: www.irislune.com

Ingredients: Peach, yellow pepper, vinegar, extra virgin, olive oil, garlic, sugar, Vietnamese red chili, salt.