Skip to content

Instantly share code, notes, and snippets.

View kwilczynski's full-sized avatar
🍀

Krzysztof Wilczyński kwilczynski

🍀
  • Yokohama, Japan
  • 13:34 (UTC +09:00)
View GitHub Profile
@ityonemo
ityonemo / test.md
Last active May 15, 2026 05:58
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@kwilczynski
kwilczynski / test.c
Last active April 19, 2021 18:27
Cleaning up Ruby array in C extension.
#define RSTRING_EMPTY_P(s) (RSTRING_LEN(s) == 0)
static VALUE
magic_strip(VALUE v)
{
return (ARRAY_P(v) || STRING_P(v)) ? \
rb_funcall(v, rb_intern("strip"), 0) : \
Qnil;
}
@thiagokokada
thiagokokada / low-latency-kvm.md
Last active January 21, 2026 12:52
Low-latency KVM

Low-latency guests in KVM

Summary

Obtaining a low-latency guests in KVM (i.e.: low DPC latency for Windows guests) can be difficult. Without it, you may hear cracks/pops in audio or freezes in the VM, so they can be very annoying, specially for gaming dedicated VMs.

This document summarizes some of my findings on this subject.

Configuring KVM for real-time workloads

@niw
niw / README.en.md
Last active May 20, 2026 21:42
How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac. Enjoy!

NOTE: that this is current, 10/1/2021 state.

Running Windows 10 on ARM

  1. Install Xcode from App Store or install Command Line Tools on your Mac
@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 May 13, 2026 12:44
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 March 17, 2026 17:36
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
#
@RhetTbull
RhetTbull / copy_file_with_progress_bar.py
Last active November 15, 2025 06:12
Python method to copy a file with a callback (e.g. to show a progress bar). Includes example of copying with both click.progressbar and tqdm.
""" Copy a file with callback (E.g. update a progress bar) """
# based on flutefreak7's answer at StackOverflow
# https://stackoverflow.com/questions/29967487/get-progress-back-from-shutil-file-copy-thread/48450305#48450305
# License: MIT License
import os
import pathlib
import shutil