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
  • 20:59 (UTC +09:00)
View GitHub Profile
@mcastelino
mcastelino / acpi_qemu_pci_hotplug.md
Last active January 24, 2023 23:50
APCI QEMU PCI Discovery, Enumeration and Hotplug

Overview

This document attempts to call out all the elements and mechanisms involved in the discovery as well as hotplug of PCI devices including

  • QEMU framework
  • APCI Tables and Methods
  • Linux Kernel functions and tables

The logic pertaining to the GED interrupt based APCI eventing is specific to NEMU. The rest of this document is generic.

QEMU Hotplug Registration

@kwilczynski
kwilczynski / out_splunk_hec.rb.diff
Last active March 22, 2021 00:03
Add OpenSSL::PKey::EC password protected keys to fleuntd
diff --git a/lib/fluent/plugin/out_splunk_hec.rb b/lib/fluent/plugin/out_splunk_hec.rb
index fe1b486..9d8d5ad 100644
--- a/lib/fluent/plugin/out_splunk_hec.rb
+++ b/lib/fluent/plugin/out_splunk_hec.rb
@@ -42,6 +42,9 @@ module Fluent::Plugin
desc 'The private key for this client.'
config_param :client_key, :string, default: nil
+ desc 'An optional password in a case when the private key is encrypted.'
+ config_param :client_key_password, :string, default: nil
@kwilczynski
kwilczynski / psdoom-aws-ctl.go
Last active March 17, 2022 00:05
A psdoom-aws-ctl - A psdoom-ng compatible command line utility to allow psdoom-ng to kill of EC2 instance in AWS. (see: https://www.youtube.com/watch?v=jJ7AQOBSV1c)
package main
import (
"encoding/gob"
"fmt"
"io/ioutil"
"net"
"os"
"os/signal"
"strconv"
@kwilczynski
kwilczynski / policy.json
Created September 3, 2018 17:36
Enhanced Read Only IAM policy (to be added alongside "arn:aws:iam::aws:policy/ReadOnlyAccess")
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": [
"cloudformation:GetTemplate",
"dynamodb:GetItem",
"dynamodb:BatchGetItem",
"dynamodb:Query",
@ppoffice
ppoffice / build.sh
Last active July 24, 2024 15:11
Minimal Linux Build Script
#!/bin/sh
# Modified from ivandavidov/minimal-linux-script
# https://github.com/ivandavidov/minimal-linux-script
# This script includes a dynamic linked busybox, openssl, python and
# network support
set -ex
KERNEL_VERSION=4.17.2
BUSYBOX_VERSION=1.28.4
@blofeldthefish
blofeldthefish / White label Route 53 nameservers.md
Created August 23, 2018 19:42
AWS Route 53 white label nameserver setup
@kwilczynski
kwilczynski / brainfuck.rb
Last active January 30, 2019 15:54
Brainfuck interpreter in Ruby with small optimisation.
class BrainFuck
class ParsingError < StandardError; end
class OutOfMemoryError < StandardError; end
class AccessViolationError < StandardError; end
class Memory
MEMORY_SIZE = 30000
VALUE_SIZE = 255
def initialize
@fay59
fay59 / Quirks of C.md
Last active April 3, 2025 02:27
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
@dimaryaz
dimaryaz / dropbox_ext4.c
Created August 15, 2018 07:28
Dropbox ext4 hack
/*
* dropbox_ext4.c
*
* Compile like this:
* gcc -shared -fPIC -ldl -o libdropbox_ext4.so dropbox_ext4.c
*
* Run Dropbox like this:
* LD_PRELOAD=./libdropbox_ext4.so ~/.dropbox-dist/dropboxd
*/
@jjo
jjo / kubectl-root-in-host-nopriv.sh
Last active February 5, 2024 23:07
Yeah. Get a root shell at any Kubernetes *node* via `privileged: true` + `nsenter` sauce. PodSecurityPolicy will save us. DenyExecOnPrivileged didn't (kubectl-root-in-host-nopriv.sh exploits it)
#!/bin/sh
# Launch a Pod ab-using a hostPath mount to land on a Kubernetes node cluster as root
# without requiring `privileged: true`, in particular can abuse `DenyExecOnPrivileged`
# admission controller.
# Pod command in turn runs a privileged container using node's /var/run/docker.sock.
node=${1}
case "${node}" in
"")
nodeSelector=''
podName=${USER+${USER}-}docker-any