Skip to content

Instantly share code, notes, and snippets.

View kwilczynski's full-sized avatar

Krzysztof Wilczyński kwilczynski

  • Yokohama, Japan
  • 20:50 (UTC +09:00)
View GitHub Profile
@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
@vegard
vegard / kernel-dev.md
Last active September 11, 2025 08:12
Getting started with Linux kernel development

Getting started with Linux kernel development

Prerequisites

The Linux kernel is written in C, so you should have at least a basic understanding of C before diving into kernel work. You don't need expert level C knowledge, since you can always pick some things up underway, but it certainly helps to know the language and to have written some userspace C programs already.

It will also help to be a Linux user. If you have never used Linux before, it's probably a good idea to download a distro and get comfortable with it before you start doing kernel work.

Lastly, knowing git is not actually required, but can really help you (since you can dig through changelogs and search for information you'll need). At a minimum you should probably be able to clone the git repository to a local directory.

@muff-in
muff-in / resources.md
Last active September 19, 2025 19:19
A curated list of Assembly Language / Reversing / Malware Analysis / Game Hacking-resources
@kwilczynski
kwilczynski / callback.c
Last active March 22, 2021 00:38
PM driver callbacks helper
// Using the && (logical AND) operator.
#define pm_driver_has_callback(__device, __callback) \
((__device)->driver && (__device)->driver->pm && (__device)->driver->pm->__callback)
#define pm_driver_do_callback(__device, __callback) \
(pm_driver_has_callback(__device, __callback) ? (__device)->driver->pm->__callback(__device) : 0)
// Using a statement expression to avoid using ternary operator...
@kwilczynski
kwilczynski / Vagrantfile
Last active May 11, 2022 13:51
Vagrant box ubuntu/focal64 and Ubuntu 20.04 freezing on vagrant up - fix by enabling serial console writing to /dev/null.
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/focal64"
config.vm.provider "virtualbox" do |vb|
vb.customize [ "modifyvm", :id, "--uartmode1", "file", "/dev/null" ]
end
end
@ChristopherA
ChristopherA / brew-bundle-brewfile-tips.md
Last active September 21, 2025 14:51
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

@kwilczynski
kwilczynski / dmesg.txt
Last active March 22, 2021 00:29
The amazing mini-PC S200 with i9-9880H from EGLOBAL
[ 5.250222] snd_hda_intel 0000:00:1f.3: enabling device (0000 -> 0002)
[ 5.255513] ------------[ cut here ]------------
[ 5.255514] WARN_ON(!IS_PLATFORM(dev_priv, INTEL_SKYLAKE) && !IS_PLATFORM(dev_priv, INTEL_KABYLAKE))
[ 5.255562] WARNING: CPU: 3 PID: 518 at drivers/gpu/drm/i915/i915_drv.c:192 intel_pch_type+0x1f3/0x5f0 [i915]
[ 5.255563] Modules linked in: i915(+) snd_hda_intel snd_intel_nhlt snd_hda_codec drm_kms_helper snd_hda_core drm snd_hwdep snd_pcm i2c_algo_bit snd_timer fb_sys_fops snd syscopyarea intel_rapl_perf(+) sysfillrect sysimgblt soundcore input_leds intel_pch_thermal pcspkr intel_wmi_thunderbolt serio_raw topstar_laptop sparse_keymap acpi_pad acpi_tad fjes(-) mac_hid zcommon(PO+) znvpair(PO) spl(O) vhost_net vhost tap ib_iser rdma_cm iw_cm ib_cm ib_core iscsi_tcp libiscsi_tcp libiscsi sunrpc scsi_transport_iscsi ip_tables x_tables autofs4 xfs btrfs xor zstd_compress raid6_pq libcrc32c psmouse i2c_i801 r8169 ahci realtek libahci wmi video
[ 5.255579] CPU: 3 PID: 518 Comm:
kwilczynski@ubuntu:~$ grpcurl kw-alpha4.us-east1.apps.lbcs.io:443 describe
com.example.myservice.MyService is a service:
service MyService {
rpc AddItem ( .com.example.myservice.MyAddItem ) returns ( .google.protobuf.Empty ) {
option (.google.api.http) = { post:"/state/{user_id}/items/add" body:"*" };
}
rpc GetState ( .com.example.myservice.MyGetState ) returns ( .com.example.myservice.MyState ) {
option (.google.api.http) = { get:"/state/{user_id}" additional_bindings:<get:"/state/{user_id}/items" response_body:"items" > };
}
rpc RemoveItem ( .com.example.myservice.MyRemoveItem ) returns ( .google.protobuf.Empty ) {
@smallnest
smallnest / fork_and_daemon.go
Created April 20, 2020 06:52 — forked from wrfly/fork_and_daemon.go
golang fork and exec and handle signals
package main
import (
"flag"
"fmt"
"log"
"os"
"os/signal"
"syscall"
)