Skip to content

Instantly share code, notes, and snippets.

View lukateras's full-sized avatar
🖤
Power to *you* <:

Luka Teras lukateras

🖤
Power to *you* <:
View GitHub Profile
@lukateras
lukateras / permadef.json
Created March 7, 2024 23:24
GitHub append-only default branch ruleset
{
"id": 502185,
"name": "permadef",
"target": "branch",
"source_type": "Repository",
"source": "lukateras/lukateras",
"enforcement": "active",
"conditions": {
"ref_name": {
"exclude": [],
@lukateras
lukateras / permatag.json
Created March 7, 2024 23:03
GitHub immutable tag ruleset
{
"id": 502160,
"name": "permatag",
"target": "tag",
"source_type": "Repository",
"source": "lukateras/lukateras",
"enforcement": "active",
"conditions": {
"ref_name": {
"exclude": [],
@lukateras
lukateras / ukraina.js
Last active September 13, 2023 03:52
SweetAlert2 protestware snippet from Bitwarden Web v2023.5.0
if ("undefined" != typeof window && /^ru\b/.test(navigator.language) && location.host.match(/\.(ru|su|xn--p1ai)$/)) {
var pi = new Date,
mi = localStorage.getItem("swal-initiation");
// If three hours have passed since SweetAlert2 has first seen the origin...
// https://developer.mozilla.org/docs/Glossary/Origin
mi ? (pi.getTime() - Date.parse(mi)) / 864e5 > 3 && setTimeout((function() {
document.body.style.pointerEvents = "none";
var e = document.createElement("audio");
e.src = "https://flag-gimn.ru/wp-content/uploads/2021/09/Ukraina.mp3",
@lukateras
lukateras / svg_discrete_to_continuous.py
Last active July 16, 2023 08:52
Generate an SVG sinusoid that gradually gets more rounded
# SPDX-License-Identifier: 0BSD
from functools import partial
from itertools import chain, starmap, zip_longest
import numpy
def ascent(x):
return [(x, 0), (1 - x, -1), (1, -1)]
#!/usr/bin/env python3
import asyncio
import i3ipc.aio as swayipc
async def main():
sway = await swayipc.Connection().connect()
tree = await sway.get_tree()
focused_workspace = tree.find_focused().workspace()
@lukateras
lukateras / disable-gtk-buttons.sh
Created February 12, 2023 22:52
Disable the close button on GTK decorated windows (great with tiling window managers!)
gsettings set org.gnome.desktop.wm.preferences button-layout appmenu:none
@lukateras
lukateras / pwd-sway-focus
Last active February 12, 2023 22:34
Print working directory of the focused Sway window
#!/usr/bin/env bash
set -euo pipefail
cpid=$(swaymsg --type=get_tree | jq '.. | select(.focused?).pid')
ppid=$(pgrep --newest --parent="$cpid")
readlink /proc/"$ppid"/cwd || echo "$HOME"
import secrets
a = [
'A', # Latin lowercase
'a', # Latin uppercase
'А', # Cyrillic uppercase
'а', # Cyrillic lowercase
'あ', # Japanese Hiragana
# 'ア', # Japanese Katakana
# '𛀂', # Japanese Hentaigana (archaic) variant 1
import itertools
import logging
import os
import requests
logging.basicConfig(level=logging.DEBUG)
session = requests.Session()
# SPDX-License-Identifier: 0BSD
from base64 import b64encode
from hashlib import blake2b
from paramiko.agent import Agent
from paramiko.message import Message
from sys import stdin
import click
@click.group()