Skip to content

Instantly share code, notes, and snippets.

View kwilczynski's full-sized avatar
:octocat:

Krzysztof Wilczyński kwilczynski

:octocat:
View GitHub Profile
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}
@kwilczynski
kwilczynski / cmdline.txt
Last active November 18, 2021 04:00
Raspberry Pi 4 - /boot/cmdline.txt
coherent_pool=1M
8250.nr_uarts=1
dwc_otg.fiq_fix_enable=1
dwc_otg.lpm_enable=0
dwc_otg.microframe_schedule=1
dwc_otg.nak_holdoff_enable=1
sdhci-bcm2708.missing_status=0
snd_bcm2835.enable_compat_alsa=0
snd_bcm2835.enable_hdmi=1
bcm2708_fb.fbwidth=0
server_names = [
'cloudflare',
'doh-crypto-sx',
'ams-doh-nl',
# Possible issues.
# 'faelix-ch-ipv4-doh',
'doh.ffmuc.net'
]
listen_addresses = [
// Based on https://github.com/ericwbailey/millennials-to-snake-people.
function walkTextNodes(rootNode) {
let walker = document.createTreeWalker(rootNode, NodeFilter.SHOW_TEXT,
function(node) {
if (node.textContent.length === 0) {
return NodeFilter.FILTER_SKIP;
}
return NodeFilter.FILTER_ACCEPT
},
@kwilczynski
kwilczynski / script.sh
Last active June 30, 2023 14:33
Build cppcheck
make clean
export PATH='/usr/local/bin:/usr/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
sudo make MATCHCOMPILER=yes HAVE_RULES=yes FILESDIR='/usr/share/cppcheck' CXXFLAGS='-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function' -j$(nproc) install
@kwilczynski
kwilczynski / script.sh
Last active November 2, 2021 15:39
Build sparse
make clean
export PATH='/usr/local/bin:/usr/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
make PREFIX='/usr' -j$(nproc)
make DESTDIR='/tmp/sparse' PREFIX='/usr' install
Install the "xdotool" utility as usual on Ubuntu, then go to "/lib/systemd/system-sleep"
directory and create a small shell script called "capslock" with the following content:
#!/bin/sh
case "$1" in
post)
/usr/bin/logger -t suspend -s 'Resetting CapsLock key'
/usr/bin/xdotool --clearmodifiers --delay 500 --repeat 2 Caps_Lock
;;
@kwilczynski
kwilczynski / nginx-log.service
Created June 12, 2021 19:56
A dummy systemd Unit to fix Nginx error_log problem even when /dev/null path is set
[Unit]
Description=Dummy unit to create log directory for Nginx
After=network.target
[Service]
Type=oneshot
ExecStart=/bin/mkdir -p /var/log/nginx
ExecStart=/bin/chown root:adm /var/log/nginx
ExecStart=/bin/chmod 755 /var/log/nginx
@kwilczynski
kwilczynski / content.js
Last active May 13, 2023 09:09
Simple Chrome extension that replaces Git commit IDs and URL with proper links
var textAreasCount = 0;
var linesCount = 0;
var linesReplaced = 0;
var linesSkipped = 0;
var start = performance.now();
function formatMilliseconds(ms) {
return Number.parseFloat(ms.toFixed(3))
@kwilczynski
kwilczynski / patch.diff
Created May 4, 2021 00:15
systemd 246 systemd-rfkill fix
diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c
index 5019828..e2b9773 100644
--- a/src/rfkill/rfkill.c
+++ b/src/rfkill/rfkill.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: LGPL-2.1+ */
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
#include <linux/rfkill.h>