Skip to content

Instantly share code, notes, and snippets.

@hazcod
hazcod / ttlmap.go
Created Sep 15, 2020
Go sync.map with TTL and per-second scavenging
View ttlmap.go
type TTLMap struct {
TTL time.Duration
data sync.Map
}
type expireEntry struct {
ExpiresAt time.Time
Value interface{}
}
@hazcod
hazcod / plexdrive.service
Created Aug 25, 2020
plexdrive systemd settings
View plexdrive.service
#### systemd script (/etc/systemd/system/plexdrive.service):
[Unit]
Description=Plexdrive
AssertPathIsDirectory=/media/plex/
After=network-online.target
### CONFIGURED FOR MAX ~58GB of MEMORY (change max-chunks to lower)
@hazcod
hazcod / osquery-queries.json
Created Jun 16, 2020
osquery queries extracted from kolide.
View osquery-queries.json
{
"options": {
"disable_audit": false,
"disable_events": false,
"enable_mouse_events": false,
"enable_keyboard_events": false,
"events_max": 10000,
"events_expiry": 3600,
"read_max": 52428800,
"logger_event_type": false,
@hazcod
hazcod / plex.sh
Last active May 12, 2020
Sonarr & Plex plex scanner.
View plex.sh
#!/usr/bin/env bash
type="$1"
PLEXSCAN="/Applications/Plex Media Server.app/Contents/MacOS/Plex Media Scanner"
if [ "$type" != "Series" ] && [ "$type" != "Movies" ]; then
echo "Unknown type: $type"
exit 1
fi
@hazcod
hazcod / port-scanner.go
Last active Apr 21, 2020
Simple port scanner. Scans full host in 24sec.
View port-scanner.go
package main
import (
"context"
"fmt"
"github.com/pkg/errors"
"net"
"strings"
"sync"
"syscall"
@hazcod
hazcod / telenet-modem-firewall.txt
Created Mar 26, 2020
Telenet modem firewall ruleset.
View telenet-modem-firewall.txt
# Generated by iptables-save v1.4.21 on Sun Jan 19 08:14:54 2020
*raw
:PREROUTING ACCEPT [17478:786616]
:OUTPUT ACCEPT [15285:6842393]
COMMIT
# Completed on Sun Jan 19 08:14:54 2020
# Generated by iptables-save v1.4.21 on Sun Jan 19 08:14:54 2020
*nat
:PREROUTING ACCEPT [412:43501]
:INPUT ACCEPT [54:3686]
@hazcod
hazcod / github-archive-org.sh
Created Nov 28, 2019
Clone all your organization repositories on GitHub.
View github-archive-org.sh
#!/usr/bin/env bash
# will ask for your personal access token
GH_USER=""
GH_ORG=""
curl -u "${GH_USERNAME}" -s "https://api.github.com/orgs/${GH_ORG}/repos?per_page=200" | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@hazcod
hazcod / wgcf.sh
Created Oct 16, 2019
Connect to Cloudflare Warp from macOS.
View wgcf.sh
#!/usr/bin/env bash
set -euo pipefail
shopt -s inherit_errexit 2>/dev/null || true
# this script will connect macOS to Cloudflare Warp using Wireguard
# note: this is *absolutely not* an official client from Cloudflare
# Copyright (C) 2019 Jay Freeman (saurik)
# Zero Clause BSD license {{{
@hazcod
hazcod / gumball.sh
Created Oct 3, 2019
Download Gumball dutch episodes.
View gumball.sh
#!/bin/sh
youtube-dl --match-title 'Volledige\sAflevering' \
--output "~/Desktop/%(title)s.%(ext)s" \
https://www.youtube.com/playlist?list=PL-AMfRCN-wkrIC7mps3rmJJU1PmcDY15X
View docker-swarm-security-groups.tf
locals {
instanceTcpPorts = ["${var.ssh_port}", 80, 433, 7946]
instanceUdpPorts = [7946, 4789]
managerTcpPorts = ["${var.ssh_port}", 80, 433, 2377, 7946]
managerUdpPorts = [7946, 4789]
}
resource "scaleway_security_group" "swarm_instance" {
name = "swarm_instances"
You can’t perform that action at this time.