Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Hello 👋

Krzysztof Wilczyński kwilczynski

:octocat:
Hello 👋
View GitHub Profile
View file.txt
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
;;
View gist:198db6346476c8f339bad89cfc31ba53
Our PCI universe is right in-between CPU, memory, devices, etc.
And being specialised coming to write drivers for us, or to work on the PCI core is hard.
We just need to identify what to write about - some ideas:
- Basics, so things about PCI sub-system, how it works, how do we interact with others
- Common errors in design and things to avoid e.g., driver authoring pitfalls (with emphasis on PCI sub-system), sysfs in PCI, and so on
- Examples of good drivers and/or usage
- How we use things such as IOMMU, VFIO, PM in PCI, Hotplug, MSI/MSI-X, DMA, etc.
- Upcoming features: PCI-Express SIG (here not a lot of people has access to) and what's new there, upcoming new features, etc.
@kwilczynski
kwilczynski / nginx-log.service
Created Jun 12, 2021
A dummy systemd Unit to fix Nginx error_log problem even when /dev/null path is set
View nginx-log.service
[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 Jul 27, 2021
Simple Chrome extension that replaces Git commit IDs and URL with proper links
View content.js
var textAreasCount = 0;
var linesCount = 0;
var linesReplaced = 0;
var linesSkipped = 0;
var start = performance.now();
function findTextNodes(body) {
let walker = document.createTreeWalker(body, NodeFilter.SHOW_TEXT,
@kwilczynski
kwilczynski / patch.diff
Created May 4, 2021
systemd 246 systemd-rfkill fix
View patch.diff
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>
View gist:ffda285e2b5c730acb290dbaa33b4db3
### Keybase proof
I hereby claim:
* I am kwilczynski on github.
* I am kwilczynski (https://keybase.io/kwilczynski) on keybase.
* I have a public key ASAncxpmyV_AD9ve3ax9YA1rXqZvtgkY2JHhC3BRUBVweQo
To claim this, I am signing this object:
View patch.diff
From 0103f1ae79ce480efd29f7396fabc90ea0f84d36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= <kw@linux.com>
Date: Thu, 4 Mar 2021 23:56:14 +0000
Subject: [PATCH] PCI: Convert dynamic "config" sysfs object into static
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The "config" sysfs object, which is a binary read-and-write attribute,
resides at the "/sys/bus/pci/devices/.../config" path and allows for
@kwilczynski
kwilczynski / extconf.rb
Last active Jun 12, 2021
Custom Ruby type check to fix problem with JRuby and TruffleRuby
View extconf.rb
# frozen_string_literal: true
require 'mkmf'
dir_config('test')
create_header
create_makefile('test')
@kwilczynski
kwilczynski / script.sh
Created Mar 23, 2021
Dump ad list (ad blocking list), whitelist and blacklist from Sqlite database on Pi Hole
View script.sh
sqlite3 gravity.db.backup -header -csv 'select * from adlist' > adlist.csv
sqlite3 gravity.db.backup -header -csv 'select * from vw_whitelist' > whitelist.csv
sqlite3 gravity.db.backup -header -csv 'select * from vw_blacklist' > blacklist.csv
@kwilczynski
kwilczynski / script.sh
Last active Jul 25, 2021
Build Coccinelle from the source code
View script.sh
cd ..
python3 -m venv coccinelle
cd -
. bin/activate
make clean
./autogen
autoreconf -i