Skip to content

Instantly share code, notes, and snippets.

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/cred.h>
static char* user_string;
static int __init my_init(void)
{
#include <linux/kernel.h> // for printk
#include <linux/module.h> // for init_module and exit_module
#include <linux/keyboard.h> // for register_keyboard_notifier and unregister_keyboard_notifier
#include <linux/sched.h> // for current
// flag to track whether the string has been entered
static bool string_entered = false;
// callback function for keyboard events
static int keyboard_notifier_callback(struct notifier_block *nb, unsigned long code, void *_param)
@dzaczek
dzaczek / kdbxbond.c
Created December 6, 2022 21:16
Kernel module test
#include <linux/kernel.h> // for printk
#include <linux/module.h> // for init_module and exit_module
#include <linux/keyboard.h> // for register_keyboard_notifier and unregister_keyboard_notifier
// flag to track whether the string has been entered
static bool string_entered = false;
// callback function for keyboard events
static int keyboard_notifier_callback(struct notifier_block *nb, unsigned long code, void *_param)
{
@dzaczek
dzaczek / life.go
Created December 6, 2022 20:34
gameof life
package main
import (
"fmt"
"github.com/nsf/termbox-go"
)
const (
width = 60
height = 20
sudoroot@pihole:~# sqlite3 /etc/pihole/gravity.db "SELECT address FROM adlist ;"
http://hole.cert.pl/domains/domains_hosts.txt
https://blocklistproject.github.io/Lists/abuse.txt
https://blocklistproject.github.io/Lists/ads.txt
https://blocklistproject.github.io/Lists/fraud.txt
https://blocklistproject.github.io/Lists/malware.txt
https://blocklistproject.github.io/Lists/piracy.txt
https://blocklistproject.github.io/Lists/scam.txt
https://blocklistproject.github.io/Lists/tracking.txt
https://osint.digitalside.it/Threat-Intel/lists/latestdomains.txt
### Keybase proof
I hereby claim:
* I am dzaczek on github.
* I am dzaczek (https://keybase.io/dzaczek) on keybase.
* I have a public key ASARWaNv4rqY4t7oYsYKuhIE3y46LYHpleJjkpRSsNAiVQo
To claim this, I am signing this object:
lspci -k | grep -iEA5 'vga|display|3d'
@dzaczek
dzaczek / sudoku.py
Created March 30, 2020 20:26
sudoku
#!/usr/bin/python3.7
import numpy as np
import os
import time
#grid=[ [0,0,0,2,6,0,7,0,1],[6,8,0,0,7,0,0,9,0],[1,9,0,0,0,4,5,0,0],[8,2,0,1,0,0,0,4,0],[0,0,4,6,0,2,9,0,0],[0,5,0,0,0,3,0,2,8],[0,0,9,3,0,0,0,7,4],[0,4,0,0,5,0,0,3,6],[7,0,3,0,1,8,0,0,0] ]
#grid=np.zeros((9, 9))
#World's hardest sudoku
grid=[[8,0,0,0,0,0,0,0,0],[0,3,6,0,0,0,0,0,0],[0,7,0,0,9,0,2,0,0],[0,5,0,0,0,7,0,0,0],[0,0,0,0,4,5,7,0,0],[0,0,0,1,0,0,0,3,0],[0,0,1,0,0,0,0,6,8],[0,0,8,5,0,0,0,1,0],[0,9,0,0,0,0,4,0,0]]
print(np.matrix(grid))
hass --script auth -c /config change_password <user> <password>
#First step save from tamplete {{ states.sensor|map(attribute='entity_id')|list }} output to file sensor.txt
#dic1=(brightness conductivity temperature battery moisture);
dic1=(brightness conductivity temperature moisture);
filter0=$(cat sensors.txt| sed "s/\('\|\[\|\]\)//g" | sed 's/,/\n/g' | grep sensor)
filter1=$(echo "${filter0}"| sed "s/'//g" | sed 's/,/\n/g' | grep sensor | cut -d. -f2 | rev | cut -d "_" -f2- | rev | sort | uniq | grep -v "light\|trad\|yr\|dunn\|aare\|sofa\|memory\|sonoff\|0x00\|cpu\|bytes\|vac\|x2\|total\|huawei\|ip_\|processor\|load\|disk")