Skip to content

Instantly share code, notes, and snippets.

View kwilczynski's full-sized avatar
🐧
Have you built a Linux kernel recently?

Krzysztof Wilczyński kwilczynski

🐧
Have you built a Linux kernel recently?
  • Yokohama, Japan
  • 06:04 (UTC +09:00)
View GitHub Profile
@atomlab
atomlab / wigeguard_setup.md
Last active March 12, 2022 22:03
Wireguard setup on Ubuntu 18.04

Wireguard setup on Ubuntu 16.04/18.04

Install

# sudo add-apt-repository ppa:wireguard/wireguard
# sudo apt-get update
# sudo apt-get install wireguard

Generate keys

@corvuscrypto
corvuscrypto / main.go
Last active October 17, 2024 15:30
Golang fork + prctl PDEATHSIG control example
package main
import (
"fmt"
"os"
"os/exec"
"os/signal"
"strconv"
"syscall"
)
@kwilczynski
kwilczynski / example.tf
Last active March 22, 2021 00:20
Set resources fields dynamically in Terraform
provider "aws" {
region = "us-east-1"
}
variable "lifecycle_rule" {
default = {
enabled = true
}
}
@ross-newman
ross-newman / QEMU PPC Setup for Debian
Last active May 2, 2025 15:22
Building PPC Linux code using QEMU on Ubuntu 18.04 LTS
#!/bin/bash
echo "Building Debina 10 QEMU instance..."
wget https://cdimage.debian.org/cdimage/ports/10.0/powerpc/iso-cd/debian-10.0-powerpc-NETINST-1.iso
sudo apt install qemu
# Create new disk for install
qemu-img create -f qcow2 debian10.qcow2 2000M
# Boot the install image
qemu-system-ppc -L pc-bios -boot d -M mac99 -m 1024 -net nic,model=sungem -net user -hda debian10.qcow2 -cdrom ./debian-10.0-powerpc-NETINST-1.iso -g 1024x768x8
# Run the image
qemu-system-ppc -L pc-bios -boot c -prom-env "boot-device=hd:,\yaboot" -prom-env "boot-args=conf=hd:,\yaboot.conf" \
@CAFxX
CAFxX / golang_minimize_allocations.md
Last active March 9, 2025 14:32
Minimize allocations in Go

📂 Minimize allocations in Go

A collection of tips for when you need to minimize the number of allocations in your Go programs.

Use the go profiler to identify which parts of your program are responsible for most allocations.

⚠️ Never apply these tricks blindly (i.e. without measuring the actual performance benefit/impact). ⚠️

Most of these tricks cause a tradeoff between reducing memory allocations and other aspects (including e.g. higher peak memory usage, higher CPU usage, lower maintainability, higher probability of introducing subtle bugs). Only apply these tricks if the tradeoff in every specfic case is globally positive.

@kwilczynski
kwilczynski / 99-powertargets.rules
Last active March 22, 2021 00:17
Allow intel-undervolt to be executed on AC to Battery and Batter to AC change ensuring proper undervolting.
SUBSYSTEM=="power_supply", KERNEL=="AC", ATTR{online}=="0", RUN+="/bin/systemctl start battery.target"
SUBSYSTEM=="power_supply", KERNEL=="AC", ATTR{online}=="1", RUN+="/bin/systemctl start ac.target"
@kwilczynski
kwilczynski / docker-compose.raspbian.yml
Last active April 21, 2019 01:04
Running Ubiquiti Unifi and MongoDB under Docker.
version: '2'
services:
unifi:
container_name: 'unifi'
hostname: 'raspberry'
image: 'jacobalberty/unifi:arm32v7-beta'
network_mode: 'host'
environment:
TZ: 'Europe/Berlin'
@kwilczynski
kwilczynski / docker-compose.yml
Created April 17, 2019 21:16
Docker Compose used to run Pi Hole (pi-hole) on RaspberryPi 3 as a Docker container.
version: '2'
services:
pihole:
container_name: 'pihole'
hostname: 'raspberry'
image: 'pihole/pihole:latest'
ports:
- '53:53/tcp'
- '53:53/udp'
@kwilczynski
kwilczynski / allocator-details.sh
Created April 15, 2019 18:16
Allocator reconciliation - Platform vs Amazon Web Services (AWS)
for f in *.txt; do \
( r=$(echo $f | sed -e 's/.*_//; s/\.txt//'); mkdir -p $r; grep -E '^ERROR' $f | \
awk '{ print $2 }' | awk '{ print length, $0 }' | sort -n | awk '{ print $2 }' | \
while read i; do ecl --config foundit --region $r allocators --all -f "instanceId:$i" --output json > "${r}/${i}.txt"; done ) &
done
@danopia
danopia / 1_floating.go
Last active December 1, 2023 03:20
examples of adding a title to olekukonko/tablewriter in post
package main
import (
"fmt"
"strings"
"github.com/google/uuid"
"github.com/olekukonko/tablewriter"
)