Skip to content

Instantly share code, notes, and snippets.

View oprypin's full-sized avatar

Oleh Prypin oprypin

View GitHub Profile
@oprypin
oprypin / konversation.patch
Created November 10, 2018 20:44
Patches to integrate bridge bot messages (FromGitter)
diff --unified --recursive konversation-1.7.2/src/viewer/chatwindow.cpp konversation-1.7.2.new/src/viewer/chatwindow.cpp
--- konversation-1.7.2/src/viewer/chatwindow.cpp 2017-05-09 17:29:00.000000000 +0200
+++ konversation-1.7.2.new/src/viewer/chatwindow.cpp 2017-11-07 00:13:25.359449297 +0100
@@ -278,7 +278,15 @@
void ChatWindow::append(const QString& nickname, const QString& message, const QHash<QString, QString> &messageTags, const QString& label)
{
if(!textView) return;
- textView->append(nickname, message, messageTags, label);
+ QString nickname_ = nickname;
+ QString message_ = message;
#!/usr/bin/env python3
"""Create a file tree with all chat logs from Quassel.
Usage:
./dump_quassel_logs.py /var/lib/quassel/quassel-storage.sqlite
The file names will have this format:
./network/#channel/YYYY-MM-DD.log
The lines in each file will have this format:
[HH:MM:SS] <nick> message
@oprypin
oprypin / THE 99 HOLE.lua
Created August 5, 2018 21:19
My SHENZHEN I/O puzzles
function get_name()
return "THE 99-HOLE"
end
function get_description()
return {
"*alice* is an XBus input connected to an electronic transmitter.",
"*bob* is an XBus output connected to an electronic receiver.",
"Receive packets of data from *alice* and send them to *bob*.",
"Numbers are between 1 and 26.",
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin,all/all
Actions=openShellHere;
[Desktop Action openShellHere]
Name=Open Shell Here
Icon=utilities-terminal
Exec=/usr/bin/env fbf=%f /usr/bin/konsole
@oprypin
oprypin / parraleln.cr
Last active March 5, 2021 02:23
Crystal parallel jobs from an array
def paralleln(items : Indexable(T), &block : T -> R) forall T, R
results = Array(R).new(items.size) { r = uninitialized R }
done = Channel(Exception?).new
items.each_with_index do |item, i|
spawn do
begin
results[i] = block.call(item)
rescue e
done.send e
#!/usr/bin/env python
import re
last_lines = lines = None
with open('/var/log/pacman.log') as log_file:
for line in log_file:
if re.search(r'\btransaction started\b', line):
lines = []
@oprypin
oprypin / instructions.md
Last active February 26, 2026 10:58
systemd user unit + timer example

Save these files as ~/.config/systemd/user/some-service-name.*

Run this now and after any modifications: systemctl --user daemon-reload

Try out the service (oneshot): systemctl --user start some-service-name

Check logs if something is wrong: journalctl -u --user-unit some-service-name

Start the timer after this user logs in: systemctl --user enable --now some-service-name.timer

diff --unified --recursive konversation-1.7.2/src/viewer/chatwindow.cpp konversation-1.7.2.new/src/viewer/chatwindow.cpp
--- konversation-1.7.2/src/viewer/chatwindow.cpp 2017-05-09 17:29:00.000000000 +0200
+++ konversation-1.7.2.new/src/viewer/chatwindow.cpp 2017-11-07 00:03:57.217338235 +0100
@@ -278,7 +278,15 @@
void ChatWindow::append(const QString& nickname, const QString& message, const QHash<QString, QString> &messageTags, const QString& label)
{
if(!textView) return;
- textView->append(nickname, message, messageTags, label);
+ QString nickname_ = nickname;
+ QString message_ = message;
@oprypin
oprypin / check_passwords.cr
Last active November 13, 2025 11:46
Check your passwords against https://haveibeenpwned.com/Passwords
# Check your passwords against https://haveibeenpwned.com/Passwords
# Usage:
# crystal check_passwords.cr -- pwned-passwords-sha1-ordered-by-hash*.txt
# Enter your passwords one per line, then press Return twice. Or pipe them in.
require "digest/sha1"
passwords = Array(String).new
until (line = gets(chomp: true) || "").empty?
passwords << line