Skip to content

Instantly share code, notes, and snippets.

@kraftwerk28
kraftwerk28 / init.lua
Created October 23, 2021 13:35
not-LUA
local http = require"ssl.https"
local url = require"socket.url"
local json = require"cjson"
local token = os.getenv("TOKEN")
local tguri = "https://api.telegram.org/bot"..token
local last_update_id = 0
local function process_update(update)
if not update.message then return end
@kraftwerk28
kraftwerk28 / README.md
Created August 19, 2021 19:28
Move floating window towards edges of workspace

Usage:

./push-window.sh <top|right|bottom|left>...

for example

$ ./push-window top right
$ ./push-window left
@kraftwerk28
kraftwerk28 / README.md
Last active July 31, 2025 15:48
Openweather widget for waybar

In order to make it work, supply OPENWEATHER_APP_ID environment variable, which you must get from https://openweathermap.org/ and, optionally, OPENWEATHER_LOCATION, otherwise script will grab your IP-based geolocation using https://ip-api.com.

@kraftwerk28
kraftwerk28 / build-gradle.kts
Created July 4, 2021 11:33
spigot-tg-bridge build.gradle.kts
import org.yaml.snakeyaml.Yaml
import java.io.*
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
mavenCentral()
maven("https://plugins.gradle.org/m2/")
}
@kraftwerk28
kraftwerk28 / init.lua
Last active June 20, 2021 14:42
Open links with documentation in neovim instead of browser
-- Put this somewhere in init.lua
if vim.fn.has"unix" then
-- Listen for :help call from .desktop python script
pcall(vim.fn.serverstart, "localhost:" .. (vim.env.NVIM_LISTEN_PORT or 6969))
end
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"net/http"
"gopkg.in/tucnak/telebot.v2"
@kraftwerk28
kraftwerk28 / 03040f72702922c8.py
Last active December 12, 2025 08:55
Code stored here from ITKPI Guard bot
def test1:
...
return True
def test2:
if test1:
....
return True
{-# LANGUAGE LambdaCase #-}
import Data.Char ( isDigit
, isSpace
)
data Op = Add | Sub | Mul | Div deriving (Eq, Show)
data Item a
= Value a
use regex::Regex;
use rmpv::{decode::read_value, encode::write_value, Value};
use std::{net::TcpStream, path::PathBuf, sync::atomic};
macro_rules! rmp_vec {
() => (Value::Array(Vec::new()));
($($x:expr),+$(,)*) => (Value::from([$(Value::from($x)),+].to_vec()));
}
struct Client {
#!/usr/bin/env sh
filepath=${1}
signature=${2:-"signature.txt"}
privkey=${3:-"private_key.pem"}
pubkey=${4:-"public_key.pem"}
binsgn="${signature}.bin"
openssl genrsa -out $privkey 2048
openssl rsa -in $privkey -pubout -out $pubkey
openssl dgst -sign $privkey \