Skip to content

Instantly share code, notes, and snippets.

View kwilczynski's full-sized avatar
🍀

Krzysztof Wilczyński kwilczynski

🍀
  • Yokohama, Japan
  • 12:37 (UTC +09:00)
View GitHub Profile
@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 November 24, 2025 10:25
Example Homebrew formula for a Go command-line (CLI) binary
class Binary < Formula
desc ""
homepage ""
head do
url "", branch: "main"
depends_on "go@1.14" => :build if build.head?
end
@vegard
vegard / kernel-dev.md
Last active April 29, 2026 03:13
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 April 27, 2026 19:35
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 May 14, 2026 04:12
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.