Skip to content

Instantly share code, notes, and snippets.

View ZaWertun's full-sized avatar
💻
💻🍕🍺

Yaroslav Sidlovsky ZaWertun

💻
💻🍕🍺
View GitHub Profile
@ZaWertun
ZaWertun / konsole_semantic_integration.fish
Last active September 27, 2023 15:10
Enables semantic integration for the fish shell in the KDE Konsole terminal emulator
#!/usr/bin/fish
# Append this lines to ~/.config/fish/config.fish for automatic start:
# ```
# if functions -q konsole_semantic_integration
# konsole_semantic_integration
# end
# ```
function konsole_semantic_integration
@ZaWertun
ZaWertun / test-kirigami2.qml
Created August 27, 2023 11:23
Test onVisibilityChanged handler for Kirigami2 ApplicationWindow in Wayland
// Start with `QT_LOGGING_RULES="qml.debug=true" qmlscene-qt5 test-kirigami2.qml`
import org.kde.kirigami 2.20 as Kirigami
Kirigami.ApplicationWindow {
id: root
width: 500
height: 400
@ZaWertun
ZaWertun / export-ble-infos.py
Created February 12, 2023 20:32 — forked from Mygod/export-ble-infos.py
Export your Windows Bluetooth LE keys into Linux!
#!/usr/bin/python3
"""
Copyright 2021 Mygod
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
#!/usr/bin/bash
sudo dnf --assumeyes
--setopt=install_weak_deps=False \
--installroot=$(readlink -f ./chroot) \
--releasever=$(python3 -c 'import dnf; b=dnf.dnf.Base(); print(b.conf.releasever)') \
install dnf
@ZaWertun
ZaWertun / CapsLock.ahk
Last active October 30, 2022 16:06
AutoHotKey script to switch layouts with CapsLock key on Windows
#NoEnv
#SingleInstance force
SendMode Input
CapsLock::SwitchNextLayout()
+CapsLock::SetCapsLockState % !GetKeyState("CapsLock", "T")
;SetCapsLockState, AlwaysOff
SwitchNextLayout()
@ZaWertun
ZaWertun / mydark.ini
Created September 29, 2022 09:37
My Dark skin (for Midnight Commander)
[skin]
description = My Dark skin
[Lines]
horiz = ─
vert = │
lefttop = ┌
righttop = ┐
leftbottom = └
rightbottom = ┘
function findChildByClass(el, clazz, deep) {
let children = Array.isArray(el) ? el : Array.from(el.childNodes);
if (deep === true) {
for (let i = 0; i < children.length; ++i) {
let res = findChildByClass(children[i], clazz, true);
if (res) return res;
}
}
return children.find(i => Array.from(i.classList || []).indexOf(clazz) != -1);
}
@ZaWertun
ZaWertun / list_desktop_wallpapers.js
Created January 31, 2022 18:04
KDE Plasma - list desktop wallpapers
desktops().forEach((desktop, index) => {
desktop.currentConfigGroup = ['Wallpaper', desktop.wallpaperPlugin, 'General'];
if (desktop.screen != -1) {
let image = desktop.readConfig('Image');
print(`Desktop ${index}: ${image}\n`);
}
});
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
@ZaWertun
ZaWertun / wttr_in.rb
Created March 10, 2021 10:50
Simple script to flip header from the wttr.in weather report to the right side
#!/usr/bin/env ruby
require 'net/http'
COLORS_RE = /\e\[([;\d]+)?m/.freeze
def strip_colors(str)
str.gsub(COLORS_RE, '')
end
params = ARGV[0] || ''