Skip to content

Instantly share code, notes, and snippets.

@tyzbit
tyzbit / get-available-tech-tlds.sh
Created November 29, 2023 21:20
Simple scripts to check domain availability (from the list of cloudflare's TLDs https://www.cloudflare.com/tld-policies/)
#!/bin/bash
cloudflare_supported_tlds=(
academy
agency
app
blog
cam
camera
center
chat
@tyzbit
tyzbit / custom-config.conf
Created August 22, 2023 20:31
Setting cache-max-negative-ttl for Unbound on OPNSense 21.7 and later
cache-max-negative-ttl: 1
@tyzbit
tyzbit / json
Created August 17, 2023 19:36
n8n Plex to NewRelic workflow
{
"meta": {
"instanceId": "aa9435bb3ce60270561861142bd6fad2007ec1f2f21b7e4ae8cd074b32d19840"
},
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
@tyzbit
tyzbit / app@.service
Created July 10, 2023 20:40
Docker-Compose Systemd script
[Unit]
Description=%i service
Requires=docker.service
After=docker.service
[Service]
Restart=always
User=root
Group=docker
WorkingDirectory=/services/%i
@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 / 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 / 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),