Skip to content

Instantly share code, notes, and snippets.

@iwconfig
iwconfig / vafan-biltema-exakt-lagerstatus.user.js
Last active November 17, 2021 12:42
Detta userscript ändrar lagerstatusen på biltemas produktsidor från "(1+)" till "4 st". En jävla skillnad jöh! Biltema visar endast grovt rundade lagersiffror som (1+), (5+), (25+) osv. Det är inte så att den exakta kvantiteten inte finns tillgängligt för användaren, de visar den inte bara. KOM Å KÖP!!!!!!
// ==UserScript==
// @name för helvete biltema ge mig exakt lagerstatus
// @namespace https://github.com/iwconfig
// @version 0.3
// @description 1337 st på lagret istället för (13+)
// @author iwconfig
// @updateURL https://gist.github.com/iwconfig/da9d124977802230732cac0679a3ecfa/raw/vafan-biltema-exakt-lagerstatus.user.js
// @match https://www.biltema.se/*
// @icon https://www.google.com/s2/favicons?domain=biltema.se
// @grant none
@iwconfig
iwconfig / parse-xml.sh
Last active December 7, 2021 17:32
parse xml in pure bash
#!/usr/bin/env bash
rdom () { local IFS=\> ; read -d \< E C ;}
while rdom; do # alternatively: while IFS=\> read -d \< E C; do
case $E in
tvshow|episodedetails)
parent=${E} ;;
title|showtitle|season|episode|plot|aired|thumb)
echo ${parent}.${E}: ${C} ;;
@iwconfig
iwconfig / parse-yaml.sh
Last active December 7, 2021 17:31
parse yaml in pure bash
#!/usr/bin/env bash
ryml () { local IFS=': ' ; read E C ;}
while ryml; do # alternatively: while IFS=': ' read E C; do
case $E in
parent)
parent=${E} ;;
child)
echo ${parent}.${E}: ${C} ;;
@iwconfig
iwconfig / blocket-bostad-google-maps.user.js
Last active May 2, 2022 11:41
Lägger till en knapp vid kartan, den som visas i Blockets bostadsannonser, för att öppna annonsens address i Google Maps istället
// ==UserScript==
// @name Blocket bostad Google Maps
// @namespace http://tampermonkey.net/
// @version 0.2
// @description try to take over the world!
// @author You
// @downloadURL https://gist.github.com/iwconfig/69c74cf7fa57ef9034c0b0dee7fa20e5/raw/blocket-bostad-google-maps.user.js
// @updateURL https://gist.github.com/iwconfig/69c74cf7fa57ef9034c0b0dee7fa20e5/raw/blocket-bostad-google-maps.user.js
// @supportURL https://gist.github.com/iwconfig/69c74cf7fa57ef9034c0b0dee7fa20e5
// @match https://bostad.blocket.se/*
# Normalizes filenames and folders !!
# because fuck you HFS+
# I hate you so
# so much
# Very WIP and probably abandoned because
# I dont feel like fixing the bugs and i'll just
# consider all this as wasted time and redo my
# rsync command with `--iconv=utf-8-mac,utf-8`,
@iwconfig
iwconfig / README.md
Created May 3, 2024 20:38
Replace text, e.g. secrets, in all files in all git commits using `git filter-branch` and `sed`.

Replace text, e.g. secrets, in all files in all git commits using git filter-branch and sed.

a. Download replace-text.sh

b. Clone the gist repo in the same directory as replace-text.sh

  • using SSH url:

    1. git clone git@gist.github.com:<reponame (hash)>
  • using HTTPS url:

@iwconfig
iwconfig / svtplay-format-filters.sh
Created June 14, 2024 18:28
A more manageable yt-dlp/youtube-dl format filtering for svtplay.se. Defaults to the best quality, dash and hevc, and skips accessibilities.
#!/usr/bin/env bash
# A more manageable yt-dlp/youtube-dl format filtering for svtplay.se. It outputs a
# complete format filter string. Defaults to the best quality, dash and hevc, and
# avoids all audio accessibilities. It handles both 2-channel and 6-channel audio.
# Use --audio-multistream to merge both tracks.
# It takes zero up to three arguments, each of which is one of "best" or "worst".
# The first is for video, the second for audio and the third argument is for the
# third "generic" fallback if both the first and the second filters fail. By default
@iwconfig
iwconfig / teldrive-rclone.json
Created July 3, 2024 14:34
scoop package for teldrive rclone fork (windoze). Usage: `scoop install <url_or_path_to_teldrive-rclone.json>`
{
"homepage": "https://github.com/divyam234/rclone",
"version": "1.67.2",
"license": "MIT license",
"url": "https://github.com/divyam234/rclone/releases/download/v1.67.2/rclone-v1.67.2-windows-amd64.zip",
"hash": "e32f95a5af686f2e79515ef3eddb52b7a8a21a030388f72223261e869fa5d970",
"extract_dir": "rclone-v1.67.2-windows-amd64",
"bin": "rclone.exe",
"shortcuts": [
[
@iwconfig
iwconfig / proxmox-config-parser.py
Created August 3, 2024 19:53
Parser for Proxmox .conf files
#!/usr/bin/env python3
import configparser
import json
from pprint import pp
def parse_proxmox_config(file_path):
parser = configparser.ConfigParser(allow_no_value=True, delimiters=':')
with open(file_path, 'r') as file:
content = file.read()
@iwconfig
iwconfig / textburrito.py
Created August 4, 2024 18:44
Wraps regular text or shell commands by a specific width. Does hard wraps, word wraps and shell wraps. Handles prefixes and suffixes, initial and subsequent. Returns a wrapped string by default.
#!/usr/bin/env python3
import shlex
def wrap(string, width, prefix='', initial_prefix='', subsequent_prefix='', suffix='', initial_suffix='', subsequent_suffix='', word_wrap=False, cmd_wrap=False, join=True, join_with='\n'):
lines = []
if word_wrap or cmd_wrap:
for line in string.strip().splitlines():
line_list = []
line_length = 0
for word in shlex.split(line, posix=False) if cmd_wrap else line.split():