Skip to content

Instantly share code, notes, and snippets.

View varqox's full-sized avatar

Krzysztof Małysa varqox

View GitHub Profile
@varqox
varqox / sqlite_zip.cc
Last active August 19, 2021 14:18
Test of sqlite zipfile (disappointed me, so I switched to libzip)
// needs sqlite.h from sim's lib that is not in simlib
#include "lib/simlib/sqlite3/sqlite3.h"
#include "lib/simlib/sqlite3/zipfile.h"
#include <simlib/filesystem.h>
#include <simlib/sqlite.h>
class Zip {
SQLite::Connection conn_;
@varqox
varqox / 50-foo.rules
Last active April 13, 2019 00:00
Useful script to save some power when on battery by stopping some applications
# When on battery stop some applications from eating the power
# Install with: sudo install -Dm 0644 50-foo.rules /lib/udev/rules.d/
# SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", RUN+="/usr/sbin/killall -STOP Discord alarm-clock-applet ksysguard clementine"
# SUBSYSTEM=="power_supply", ATTR{status}!="Discharging", RUN+="/usr/sbin/killall -CONT Discord alarm-clock-applet ksysguard clementine"
SUBSYSTEM=="power_supply", ACTION=="change", ATTR{online}=="0", RUN+="/usr/sbin/pkill -STOP --exact ksysguard"
SUBSYSTEM=="power_supply", ACTION=="change", ATTR{online}=="1", RUN+="/usr/sbin/pkill -CONT --exact ksysguard"
# Run kayboard normalizer
# SUBSYSTEM=="input", SUBSYSTEMS=="usb", ACTION=="add", RUN+="/home/quasar/Documents/scripts/keyboard-normalizer.sh"
@varqox
varqox / INSTALL.sh
Last active February 16, 2023 16:15 — forked from ephemient/⁄etc⁄pacman.d⁄hooks⁄linux-modules-post.hook
(Arch Linux) Keep current modules around during kernel upgrade ("30" is in the name to run before DMKS remove ("90" for install) when upgrading kernel)
#/bin/sh
# Run: curl 'https://gist.githubusercontent.com/varqox/a4e5abd490059844e0e521db531a9d8f/raw/e69686e6b63791ef82fc3e182689986ffe838a53/INSTALL.sh' | sudo sh
curl 'https://gist.githubusercontent.com/varqox/a4e5abd490059844e0e521db531a9d8f/raw/85e25433f2f67576ea82b38a7cd461d424376901/%25E2%2581%2584usr%25E2%2581%2584share%25E2%2581%2584libalpm%25E2%2581%2584hooks%25E2%2581%258430-linux-modules-pre.hook' | sudo tee /usr/share/libalpm/hooks/30-linux-modules-pre.hook
curl 'https://gist.githubusercontent.com/varqox/a4e5abd490059844e0e521db531a9d8f/raw/85e25433f2f67576ea82b38a7cd461d424376901/%25E2%2581%2584usr%25E2%2581%2584share%25E2%2581%2584libalpm%25E2%2581%2584hooks%25E2%2581%258490-linux-modules-post.hook' | sudo tee /usr/share/libalpm/hooks/90-linux-modules-post.hook
curl 'https://gist.githubusercontent.com/varqox/a4e5abd490059844e0e521db531a9d8f/raw/85e25433f2f67576ea82b38a7cd461d424376901/%25E2%2581%2584etc%25E2%2581%2584tmpfiles.d%25E2%2581%2584linux-modules-cleanup.conf' | sudo tee /etc/tmpfiles.d
@varqox
varqox / socket_stream.cc
Last active April 18, 2018 20:18
Fast socket I/O stream for my team at PIZZA 2018
// Krzysztof Małysa
#include <array>
#include <cassert>
#include <condition_variable>
#include <cstring>
#include <fcntl.h>
#include <mutex>
#include <netdb.h>
#include <netinet/in.h>
#include <poll.h>
@varqox
varqox / xxx.cc
Last active January 3, 2017 22:03
Scans ports in range to check which are available to use, you have to run it on the server side and the client side
#include <arpa/inet.h>
#include <csignal>
#include <poll.h>
#include <simlib/config_file.h>
#include <simlib/debug.h>
#include <simlib/filesystem.h>
#include <simlib/process.h>
#include <sys/resource.h>
// Krzysztof Małysa
@varqox
varqox / install_debian_with_debootstrap_howto.md
Last active April 14, 2024 21:18
Instructions how to install Debian using debootstrap
@varqox
varqox / unlint.cc
Last active August 19, 2021 14:19
Unlimited int (unlint) - all in one
#include <cstring>
#include <stack>
#include <iostream>
#ifndef __UNLINT_H
#define __UNLINT_H
#include <bits/localefwd.h>
#include <string>
#include <vector>