Skip to content

Instantly share code, notes, and snippets.

View SoptikHa2's full-sized avatar

Petr Šťastný SoptikHa2

  • FIT CTU
  • Prague
View GitHub Profile
@SoptikHa2
SoptikHa2 / koswatcher.sh
Last active January 25, 2021 23:45
Watch KOS for teacher assignment changes and notify user
#!/usr/bin/env bash
declare -A subject_teachers
#┌───────┐
#│ SETUP │
#└───────┘
# 1. Install chromedriver
# 2. Make sure notify-send properly sends notifications
# 3. (Optional) Install espeak-ng and voice bank for voice warning
(gdb) info threads
Id Target Id Frame
* 1 Thread 0x7fc3204e5900 (LWP 3788547) "alacritty" 0x00007fc320a81abb in sched_yield () from /usr/lib/libc.so.6
2 Thread 0x7fc31985c700 (LWP 3788559) "config watcher" 0x00007fc320b8be32 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
3 Thread 0x7fc31965b700 (LWP 3788560) "PTY reader" 0x00007fc320a9af3e in epoll_wait () from /usr/lib/libc.so.6
4 Thread 0x7fc31945a700 (LWP 3788561) "config watcher" 0x00007fc320b8be32 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
5 Thread 0x7fc319259700 (LWP 3788562) "config watcher" 0x00007fc320a9af3e in epoll_wait () from /usr/lib/libc.so.6
(gdb) thread 1
[Switching to thread 1 (Thread 0x7fc3204e5900 (LWP 3788547))]
#0 0x00007fc320a81abb in sched_yield () from /usr/lib/libc.so.6
@SoptikHa2
SoptikHa2 / debug-annotation.sed
Created April 21, 2020 17:26
Sed debug annotation
SED PROGRAM:
x
z
x
:x
s/$/%;%90123456789/
:y
s/(.)%((%?.)*\\1)|;.*/\3\2/
t y
/\n/ b z
import sys
from random import randint
def next_letter(probs, letter):
if not letter in probs:
return None
probs_for_letter = probs[letter]
sum_of_probs = 0
for prob in probs_for_letter:
sum_of_probs += probs_for_letter[prob]

Keybase proof

I hereby claim:

  • I am soptikha2 on github.
  • I am soptikha2 (https://keybase.io/soptikha2) on keybase.
  • I have a public key ASDpSr1gNR-vLwiyvC6a_PZhQEgmbNqBtyxssiJVZ59Itgo

To claim this, I am signing this object:

@SoptikHa2
SoptikHa2 / code-wars.rs
Created July 14, 2019 08:50
Code wars - behaviour tree
// Petr Šťastný <petr.stastny01@gmail.com>
// 2019-07-14
// trait = interface
pub trait CodingBlock {
fn execute(&self) -> Option<&Action>;
}
// Define enums. Each enum variant can
// have another type inside it.