Skip to content

Instantly share code, notes, and snippets.

View frederikaalund's full-sized avatar

Frederik Aalund frederikaalund

View GitHub Profile
@dhilst
dhilst / Makefile
Last active August 18, 2021 03:15
sysfs + character device buffer example
obj-m += cdev03.o
KDIR ?= /home/geckos/abs/linux/src/linux-3.9/
all:
make -C $(KDIR) M=$(PWD) modules
clean:
make -C $(KDIR) M=$(PWD) clean
@davidzchen
davidzchen / sample-linux.c
Last active June 16, 2024 09:01
Sample C code using the Linux kernel coding style
/*
* Sample file using the Linux kernel coding convention.
*
* https://www.kernel.org/doc/Documentation/CodingStyle
*
* General rules:
* - Indents are tabs and must be 8 spaces wide.
* - Each line must be at most 80 characters long.
* - Use C-style comments.
* - File names should be lower-case.c
@staltz
staltz / introrx.md
Last active July 15, 2024 15:43
The introduction to Reactive Programming you've been missing
@paniq
paniq / minmaxabssign.txt
Last active June 24, 2024 17:57
useful min/max/abs/sign identities
max(-x,-y) = -min(x,y)
min(-x,-y) = -max(x,y)
abs(x) = abs(-x)
abs(x) = max(x,-x) = -min(x,-x)
abs(x*a) = if (a >= 0) abs(x)*a
(a < 0) -abs(x)*a
// basically any commutative operation
min(x,y) + max(x,y) = x + y
@InfoSec812
InfoSec812 / jsonb_patch.sql
Last active July 2, 2024 21:52
Pure PostgreSQL implementation of JSONPatch
!!
!! Implementation of JSONPatch (http://jsonpatch.com/) using PostgreSQL >= 9.5
!!
CREATE OR REPLACE FUNCTION jsonb_copy(JSONB, TEXT[], TEXT[]) RETURNS JSONB AS $$
DECLARE
retval ALIAS FOR $1;
src_path ALIAS FOR $2;
dst_path ALIAS FOR $3;
tmp_value JSONB;
@Gadgetoid
Gadgetoid / README.md
Last active July 11, 2024 23:07
Raspberry Pi Zero / Windows 10 automatic RNDIS driver install for composite gadgets

Preface

I owe my very rapid learning journey in the world of ConfigFs to several key sources which aren't necessarily relevant to this result, but I feel deserve a mention anyway.

@edro15
edro15 / ForceUSBtoTTY.md
Last active April 23, 2024 00:11
[How To] Force a specific USB device to a certain TTY

Scenario:

  • multiple USB devices plugged via hub to a host (Linux OS based),
  • multiple services/programs interacting with TTY running on top (e.g. GPSd)

Problem:

At boot TTY are randomly assigned to devices causing depending services/programs instabilities. They could indeed fail to start because of different TTY configurations.

Solution:

@rubenhorn
rubenhorn / summon_window.ahk
Last active January 30, 2024 10:29
AutoHotkey script for moving active window to main monitor
#SingleInstance force
; Hotkey: Alt + S
!s::
; Check if window active window exists
WinGetTitle, t, a
if(t = "Program Manager" or t = "") {
MsgBox ,, No window selected!, Please select a window.`n(Alt + Tab)
return