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
package main
import (
"log"
"github.com/tarm/serial"
)
func main() {
c := &serial.Config{Name: "/dev/tty0", Baud: 115200}
@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 / 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 / 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 / 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

@penguinpowernz
penguinpowernz / README.md
Created August 31, 2020 00:47
Building a Debian Package from installed files

Building a Debian Package from installed files

Recently I had a package disappear on me from the mainline repos but one of my apps had a hard dependency on that version. I managed to find a machine that still had that package installed so here's what I did.

Get the file list:

dpkg -L firefox-esr|sed 1d|grep -v "package diverts" > esrfiles.txt
{
"type": "update",
"quake": {
"publicID": "2020p203673",
"time": "2020-03-16T08:37:10.376Z",
"depth": 23.87388039,
"magnitude": 1.222926187,
"locality": "10 km north-east of Matawai",
"mmi": -1,
"quality": "best",
{
"type": "new",
"quake": {
"publicID": "2020p203673",
"time": "2020-03-16T08:37:10.376Z",
"depth": 10.83877039,
"magnitude": 1.021546187,
"locality": "10 km north-east of Matawai",
"mmi": -1,
"quality": "preliminary",
#!/bin/bash
lsb_release -a|grep stretch || exit 0;
apt-get update
apt-get install asl-agent
@penguinpowernz
penguinpowernz / .codeclimate.yml
Last active May 29, 2019 03:38
Golang project codeclimate config
version: "2"
plugins:
govet:
enabled: true
golint:
enabled: true
gofmt:
enabled: true
FIXME:
enabled: true