Skip to content

Instantly share code, notes, and snippets.

Avatar

Krzysztof Małysa varqox

View GitHub Profile
@varqox
varqox / secure_eduroam.md
Created Oct 6, 2021
How to setup a *secure* eduroam connection for University of Warsaw students on Linux
View secure_eduroam.md

Introduction

This tutorial covers using NetworkManager with either wpa_supplicant or IWD backend. If you did not heard of IWD, it is propbable your NetworkManager uses wpa_supplicant.

wpa_supplicant

  1. Edit connection and set:
  • Authentication to Protected EAP (PEAP)
  • Anonymous identity to anonymous@uw.edu.pl
  • Domain to eduroam.uw.edu.pl
  • CA certificate to file located at /etc/ssl/certs/Comodo_AAA_Services_root.pem
  • Uncheck No CA certifcate is required
@varqox
varqox / backup
Last active Oct 12, 2021
Backup script (copy it to root directory of your project and run it every time you want to make a backup)
View backup
#!/bin/sh
set -e
cd -P -- "$(dirname -- "$0")" # chdir to script directory
out_file="$HOME/backup/$(echo ${PWD#$HOME/} | sed 's@/@,@g').tar.zst"
((git ls-files -z --cached --recurse-submodules 2> /dev/null &&
git ls-files -z --others --exclude-standard &&
PROJECT_DIR=$PWD git submodule foreach --quiet 'git ls-files -z -o --exclude-standard | while read -d "" x; do echo -n "${PWD#$PROJECT_DIR/}/$x"; echo -ne "\0"; done' &&
@varqox
varqox / system-installation-guide.md
Last active Mar 30, 2022
Guide for what to do just after installing a bare Arch Linux to get *my* full-fledged XFCE desktop Arch Linux and some other random Linux stuff
View system-installation-guide.md

Before rebooting after making fresh Arch installation

  • make sure to install grub using grub-install and configure it properly using grub-mkconfig -o /boot/grub/grub.cfg (for uefi it is not so easy), but before running grub-mkconfig install intel-ucode or amd-ucode
  • install networkmanager vim htop net-tools wireless_tools # net-tools for ifconfig, wireless_tools for iwconfig
  • remember to configure pacman mirrors properly see /etc/pacman.d/mirrorlist
  • reboot

On a fresh Arch installation

  • systemctl enable --now NetworkManager
  • use nmtui to connect to internet
  • install git man-pages procps-ng # procps-ng for pkill
@varqox
varqox / recording_application_and_microphone.md
Last active May 20, 2022
How to record multiple applications and microphone into one audio file on Linux using PulseAudio
View recording_application_and_microphone.md

How to record multiple applications and microphone into one audio file on Linux

Step 0. Terminology

Sinks are for output, sources are for input. To stream source to sink a loopback must be created. More shall you find there.

Step 1. Create output sink that will be recorded

Our output sink will be named recording.

pacmd load-module module-null-sink sink_name=recording sink_properties=device.description=recording
@varqox
varqox / time_test.c
Last active Apr 27, 2019
Testy do trzeciego zadania zaliczeniowego z Systemów Operacyjnych
View time_test.c
// Krzysztof Małysa
#include <assert.h>
#include <errno.h>
#include <math.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
@varqox
varqox / wlan_auto_block.sh
Last active Apr 4, 2019
Network Manager enable wifi on ethernet (LAN) disconnect and disable it on ethernet (LAN) connect, works with openvpn (VPN) and disconnecting cable when laptop is suspended
View wlan_auto_block.sh
#!/bin/sh
# Place in file: /etc/NetworkManager/dispatcher.d/pre-up.d/wlan_auto_block.sh
# Make the file safe for execution: sudo chmod 744 /etc/NetworkManager/dispatcher.d/pre-up.d/wlan_auto_block.sh
if [ "$1" = "enp3s0" ]; then
rfkill block wifi # rfkill is used for unblocking, so we have to use it for blocking
fi
@varqox
varqox / crack_sound_fix.service
Last active Mar 20, 2019
Eliminates cracking sound on resume
View crack_sound_fix.service
[Unit]
Description=Eliminate cracking headphone sound
# Enable with: sudo systemctl enable --now crack_sound_fix.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/hda-verb /dev/snd/hwC0D0 0x1d SET_PIN_WIDGET_CONTROL 0x0
StandardOutput=syslog
StandardError=syslog
@varqox
varqox / sqlite_zip.cc
Last active Aug 19, 2021
Test of sqlite zipfile (disappointed me, so I switched to libzip)
View sqlite_zip.cc
// 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 Apr 13, 2019
Useful script to save some power when on battery by stopping some applications
View 50-foo.rules
# 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 Sep 17, 2021 — 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)
View INSTALL.sh
#/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