Skip to content

Instantly share code, notes, and snippets.

View penguinpowernz's full-sized avatar

Robert penguinpowernz

  • Penguin Power
  • Auckland, New Zealand
View GitHub Profile
@penguinpowernz
penguinpowernz / README.md
Last active March 21, 2024 15:46
WPA CLI commands
command args description
status [verbose] get current WPA/EAPOL/EAP status
ifname get current interface name
ping pings wpa_supplicant
relog re-open log-file (allow rolling logs)
note <text> add a note to wpa_supplicant debug log
mib get MIB variables (dot1x, dot11)
help [command] show usage help
interface [ifname] show interfaces/select interface
@penguinpowernz
penguinpowernz / buildembeddings.go
Last active November 8, 2023 00:55
stream execve from audit.log and hopefully into an ML algo
package main
//chatgpt generated god knows if it works
import (
"fmt"
"log"
"github.com/ynqa/wego/pkg/model"
)
@penguinpowernz
penguinpowernz / wpa_supplicant.conf
Created October 28, 2016 00:06
WPA Supplicant config file explanations
##### Example wpa_supplicant configuration file ###############################
#
# This file describes configuration file format and lists all available option.
# Please also take a look at simpler configuration examples in 'examples'
# subdirectory.
#
# Empty lines and lines starting with # are ignored
# NOTE! This file may contain password information and should probably be made
# readable only by root user on multiuser systems.
@penguinpowernz
penguinpowernz / README.md
Last active April 26, 2023 18:45
Are ruby exceptions still slow when they rescue nothing?

Are ruby exceptions still slow when they rescue nothing?

So I know ruby errors are slow, thats why you don't use rescue for flow control, but what if you just want to provide an extra layer of vigilance just inside that big critical loop? It is going to affect the speed if it doesn't catch anything?

Lets bench it!

require 'benchmark'

def rescue_an_error
@penguinpowernz
penguinpowernz / README.md
Last active December 9, 2022 08:05
Genetic Algorithms in golang

Genetic Algorithms in golang

What is a genetic operator?

In the context of genetic algorithms, a genetic operator is a function that is applied to the genetic material of individuals in a population in order to create new, offspring individuals. These operators typically mimic biological processes such as crossover (also known as recombination), mutation, and selection. The purpose of these operators is to introduce variation into the population, allowing the algorithm to explore different solutions and potentially find better ones.

How would one write a genetic operator in golang?

Here is an example of how a genetic operator might be implemented in Go:

@penguinpowernz
penguinpowernz / README.md
Last active March 8, 2022 20:19
OVPN Splitter

OVPN File Splitter

Have an OpenVPN config file with inline certificates that you need to split up because the Ubuntu team haven't fixed that 2+ year old bug in Network Manger?

You've come to the right place!

This script will split the file out into it's respective certs/keys and output a replacement .ovpn file with cert/key paths.

Usage

@penguinpowernz
penguinpowernz / 0README.md
Last active February 28, 2022 08:10
Quickly installable useful utils

Quickly installable aliases and functions

curl -H 'Cache-Control: no-cache' -fsSL https://gist.githubusercontent.com/penguinpowernz/228abec1753ad08c1c2172f1c8f75ff3/raw/install.sh | bash
@penguinpowernz
penguinpowernz / README.md
Last active October 25, 2021 16:17
Chunked encoding parser for Javascript

Blow Chunks in your Javascript

So I couldn't find a wrapper library that made dealing with chunked encoding over javascript nice. So I made this. It helps you do long polling in javascript using chunked encoding.

Usage

This will add messages to the div with that class every time a chunk is received:

<html>
@penguinpowernz
penguinpowernz / etc-resolv.conf
Last active October 17, 2021 21:30
BECAUSE FUCK resolvconf
# THIS FILE MAY BE EDITED MANUALLY
nameserver 192.168.3.1
nameserver 8.8.8.8
# BECAUSE FUCK resolvconf
@penguinpowernz
penguinpowernz / 0README.md
Created April 17, 2021 13:29
Multi Tenant node-red

Multi Tenant node-red

Copy the files into the recommended places.

Then to run the service for a user that is installed on your system do:

systemctl start node-red@jim node-red@bob