Skip to content

Instantly share code, notes, and snippets.

@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 August 8, 2021 12:45
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 May 7, 2025 12: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 \
#!/usr/bin/env sh
TOKEN="api-token"
master=${1:-"master"}
APIURL="https://api.github.com"
OWNER=$(git config --get user.name)
REPO=$(basename $(git rev-parse --show-toplevel))
git checkout -b master
git push origin master
curl -s -X PATCH "$APIURL/repos/$OWNER/$REPO" \
-d "{\"default_branch\":\"master\"}" \