Skip to content

Instantly share code, notes, and snippets.

@zeratax
zeratax / k3s.nix
Last active April 6, 2024 03:02
simulating a k3s cluster in nixos
{ pkgs, lib, config, ... }:
let
### Variables:
kubeMasterIP = "192.168.188.89";
kubeMasterGateway = "192.168.188.1";
kubeMasterHostname = "gestalt.local";
kubeMasterAPIServerPort = 6443;
kubeMasterInterface = "eno1";
kubeMasterMacVlanInterface = "mv-${kubeMasterInterface}";
@zeratax
zeratax / gimages.py
Last active December 30, 2022 09:53
get first result from google image search
from bs4 import BeautifulSoup
import requests
def get_google_img(query):
"""
gets a link to the first google image search result
:param query: search query string
:result: url string to first result
"""
@zeratax
zeratax / rezept2pestle.py
Created November 26, 2022 06:28
Rezeptbuch to Pestle converter
import sqlite3
import os
import sys
import logging
import json
import math
import pprint
def write_image(image, image_path):
@zeratax
zeratax / sadfavs.py
Last active November 11, 2022 22:45
archive your sadpanda favs
# usage: sadfavs.py [-h] [-f FILE] -u USERNAME -p PASSWORD [-d] [--port PORT]
# [-a ADDRESS] [-n NUMBER]
# download sadpanda galleries with tags. archives all your favorites or all
# links (seperated by a newline) from a file. saves tags and general info for
# every gallery as a json file. to download galleries you need to run
# transmission with remote control enabled.
# optional arguments:
# -h, --help show this help message and exit
@zeratax
zeratax / booru_metadata.js
Last active September 20, 2022 15:57
scriptable booru metadata
/*
function showNotification(title, message) {
const notification = new Notification()
notification.title = title
notification.subtitle = message
notification.schedule()
}
*/
// Script.setShortcutOutput(1)
@zeratax
zeratax / hetzner-nixos-install.sh
Last active May 10, 2021 20:41
install nixos to hetzner cloud
#! /usr/bin/env bash
# Script to install NixOS from the Hetzner Cloud NixOS bootable ISO image.
# (tested with Hetzner's `NixOS 20.03 (amd64/minimal)` ISO image).
#
# This script wipes the disk of the server!
#
# Instructions:
#
# 1. Mount the above mentioned ISO image from the Hetzner Cloud GUI
{
"kana": [
{"hiragana": "あ","romaji":"a", "value": 1},
{"hiragana": "い","romaji":"i", "value": 2},
{"hiragana": "う","romaji":"u", "value": 3},
{"hiragana": "え","romaji":"r", "value": 4},
{"hiragana": "お","romaji":"o", "value": 5},
{"hiragana": "か","romaji":"ka", "value": 6},
{"hiragana": "き","romaji":"ki", "value": 7},
{"hiragana": "く","romaji":"ku", "value": 8},
@zeratax
zeratax / japanesenames.cr
Last active May 4, 2021 21:25
download japanese names from wikipedia
require "json"
require "uri"
require "http/client"
require "http/params"
API_ENDPOINT = URI.parse "https://en.wikipedia.org/w/api.php"
module Wiki
class Response
include JSON::Serializable
@zeratax
zeratax / crawler.py
Last active January 2, 2021 23:55
archive your bookmarks -- looks through exported html files (e.g. exported bookmarks) for specific websites and downloads them with youtube-dl
#####
# Installation:
# install python3 and install via pip "bs4" and "youtube_dl"
#
# Usage:
# python3 crawler.py -h
#
# Example:
# export your bookmarks with firefox and then crawl them for youtube and soundcloud by executing:
# python3 crawler.py -f bookmarks.html -w youtube.com -w youtu.be -w soundcloud.com
@zeratax
zeratax / matrix-registration.nix
Last active December 12, 2020 23:44
matrix-registration nix module example configuration
{ config, lib, pkgs, ... }:
let
# nur-pkgs = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {};
nur-pkgs = import <nur-pkgs> {};
in {
nixpkgs.config.packageOverrides = pkgs: rec {
nur = import <nur-pkgs> {
inherit pkgs;