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
  • 09:10 (UTC +09:00)
View GitHub Profile
@d4em0n
d4em0n / exploit.py
Last active November 23, 2020 09:13
Heap-HOP Dragon Sector CTF
from pwn import *
context.arch = "amd64"
context.terminal = "tmux splitw -h -f".split()
#cmd = "b* $_base()+0x1586"
cmd = ""
DEBUG = 0
p = process("./heap")
#p = remote("yetanotherheap.hackable.software", 1337)
if DEBUG:
gdb.attach(p, cmd, gdb_args=['--init-eval-command="source ~/ctf/tools/gef/gef.py"'])
@andrebrait
andrebrait / keychron_linux.md
Last active April 24, 2025 05:27
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

@littlefuntik
littlefuntik / timeouts.go
Last active December 19, 2024 14:33
Go lang request timeouts example, DialContext, context.WithTimeout, http.Client, http.NewRequestWithContext
package main
import (
"context"
"io/ioutil"
"log"
"net"
"net/http"
"time"
)
PACKAGE_NAME="nullfs"
PACKAGE_VERSION="0.1.0"
AUTOINSTALL="yes"
REMAKE_INITRD="yes"
BUILT_MODULE_LOCATION[0]="./"
BUILT_MODULE_NAME[0]="nullfs"
DEST_MODULE_LOCATION[0]="/kernel/fs"
DEST_MODULE_NAME[0]="nullfs"
CLEAN="make clean"
MAKE="make BUILD_KERNEL=${kernelver}"
@geerlingguy
geerlingguy / increase-pci-bar-space.sh
Last active January 9, 2025 01:09
Increase the BAR memory address space for PCIe devices on the Raspberry Pi Compute Module 4
#!/bin/bash
# The default BAR address space available on the CM4 may be too small to allow
# some devices to initialize correctly. To avoid 'failed to assign memory'
# errors on boot, you can increase the range of the PCIe bus in the Raspberry
# Pi's Device Tree (a .dtb file specific to each Pi model).
#
# You should probably read up on Device Trees if you don't know what they are:
# https://www.raspberrypi.org/documentation/configuration/device-tree.md
#
@apangin
apangin / proccount.c
Created October 8, 2020 21:41
Sets the number of CPUs available for a JVM in a container (JDK < 8u191)
/*
* Copyright 2020 Andrei Pangin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
$ cat > main.tf
provider "null" {
version = "2.1.1"
}
^D
$ terraform init
Initializing the backend...
Initializing provider plugins...
ARG go_version=1.17
ARG alpine_version=latest
FROM golang:${go_version}-alpine AS builder
ARG GOOS=linux
ARG GOARCH=amd64
ENV GOOS=${GOOS}
ENV GOARCH=${GOARCH}
@jgouly
jgouly / vt.md
Created September 15, 2020 23:39
Linux: Ctr-Alt-F<N> switches between virtual terminals/consoles, but how?

Linux: Ctr-Alt-F<N> switches between virtual terminals/consoles, but how?

I remembered the chvt (change foreground virtual terminal) command, so that seems like a good place to start. I looked at BusyBox's implementation in console-tools/chvt.c, hoping that it would be small enough to skim through. At 33 lines, with only 9 lines containing code I wasn't disappointed.

The call to console_make_active looks interesting. console_make_active can be found in libbb/get_console.c:

@kwilczynski
kwilczynski / binary.rb
Last active April 11, 2025 18:33
Example Homebrew formula for a Go command-line (CLI) binary
class Binary < Formula
desc ""
homepage ""
head do
url "", branch: "main"
depends_on "[email protected]" => :build if build.head?
end