Skip to content

Instantly share code, notes, and snippets.

@lucj
lucj / k3s-multipass.sh
Created December 17, 2019 21:16
Setup a k3s kubernetes cluster using Multipass VMs
for node in node1 node2 node3;do
multipass launch -n $node
done
# Init cluster on node1
multipass exec node1 -- bash -c "curl -sfL https://get.k3s.io | sh -"
# Get node1's IP
IP=$(multipass info node1 | grep IPv4 | awk '{print $2}')
@devnoname120
devnoname120 / My macOS setup.md
Last active April 17, 2025 23:46
My macOS setup

ℹ️ Enable iCloud end-to-end encryption:

  • Nobody knows that, but iCloud actually supports end-to-end encryption (see “Advanced Data Protection for iCloud”) but it's disabled by default. If you care about data privacy, you should turn it on.
    • System settingsApple IDiCloud → Set Advanced Data Protection to On.
    • System settingsApple IDiCloud → Disable Access iCloud Data on the Web.
  • It supports almost all the native Apple apps, with the notable exceptions of iCloud Mail, Contacts, and Calendars. See official data protection matrix for more info.

Table of Contents

@fryguy04
fryguy04 / dhcp_pfsense.py
Created June 23, 2019 15:15
Scrape pfSense DHCP List into Python Struct
#!/usr/bin/env python
# Scrapes pfSense DHCP Leases into List of (IP, MAC, Hostname) format.
# Change URL/Username/Password below ... pip install lxml ... then you are all set.
#
# Modified 6/23/2019 (FryGuy)
# Edits: Aligned IP/MAC/Hostname into struct accounting for blank lines
# Minor: Cleaned up spacing, created global url/user/password vars, removed write to file
# Original Code/Inspiration: https://gist.github.com/pletch/037a4a01c95688fff65752379534455f
import sys
@akorn
akorn / runcached
Last active September 3, 2024 22:15
Run specified (presumably expensive) command with specified arguments and cache result. If cache is fresh enough, don't run command again but return cached output.
#!/bin/zsh
#
# Purpose: run specified command with specified arguments and cache result. If cache is fresh enough, don't run command again but return cached output.
# Also cache exit status and stderr.
# Copyright (c) 2019-2023 András Korn; License: GPLv3
# Use silly long variable names to avoid clashing with whatever the invoked program might use
RUNCACHED_MAX_AGE=${RUNCACHED_MAX_AGE:-300}
RUNCACHED_IGNORE_ENV=${RUNCACHED_IGNORE_ENV:-0}
RUNCACHED_IGNORE_PWD=${RUNCACHED_IGNORE_PWD:-0}
@retrography
retrography / killring.plugin.zsh
Created May 17, 2019 14:56
OH-MY-ZSH Custom Plugin -- Redefines the most used kill ring bindings to sync with the system clipboard (requires clipcopy plugin)
kill-line() { zle .kill-line ; echo -n $CUTBUFFER | clipcopy }
zle -N kill-line
bindkey "^K" kill-line
kill-whole-line() { zle .kill-whole-line ; echo -n $CUTBUFFER | clipcopy }
zle -N kill-whole-line
bindkey "^U" kill-whole-line
yank() { LBUFFER=$LBUFFER$(clippaste) }
zle -N yank
@lizrice
lizrice / Vagrantfile
Created March 7, 2019 16:23
Openshift single-node cluster Vagrantfile
$ cat Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<-SCRIPT
cat > /etc/docker/daemon.json << EOF
{
"insecure-registries": [
"172.30.0.0/16"
@cristovao-trevisan
cristovao-trevisan / 1 - .zshrc
Last active November 17, 2024 10:30
zsh configuration using zinit
# # SDKMAN
# export SDKMAN_DIR="$HOME/.sdkman"
# [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
# GO
export PATH="$PATH:$HOME/go/bin"
# ZINIT
if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then

Trying to deploy WPA3 on my home network

Introduction

Recently, news broke about a new possible offline attack on WPA2 using PMKID. To summarize the attack, WPA2 protected APs can end up broadcasting PMKID values which can then be used to offline-brute-force the password.

These PMKID values are computed this way:

PMKID = HMAC-SHA1-128(PMK, "PMK Name" | MAC_AP | MAC_STA)
#!/usr/bin/env runhaskell
-- Copyright (C) 2018 Daniel Gröber <[email protected]>
--
-- Copying and distribution of this file, with or without modification,
-- are permitted in any medium without royalty provided the copyright
-- notice and this notice are preserved. This file is offered as-is,
-- without any warranty.
{-|
License: GNU All-Permissive License
@lukicdarkoo
lukicdarkoo / configure.sh
Last active February 15, 2025 02:28
Raspberry Pi: AP + client mode
#!/bin/sh
# The script configures simultaneous AP and Managed Mode Wifi on Raspberry Pi Zero W (should also work on Raspberry Pi 3)
# Usage: curl https://gist.githubusercontent.com/lukicdarkoo/6b92d182d37d0a10400060d8344f86e4/raw | sh -s WifiSSID WifiPass APSSID APPass
# Licence: GPLv3
# Author: Darko Lukic <[email protected]>
# Special thanks to: https://albeec13.github.io/2017/09/26/raspberry-pi-zero-w-simultaneous-ap-and-managed-mode-wifi/
MAC_ADDRESS="$(cat /sys/class/net/wlan0/address)"
CLIENT_SSID="${1}"
CLIENT_PASSPHRASE="${2}"