Skip to content

Instantly share code, notes, and snippets.

View karolyi's full-sized avatar
🏠
Working from home

László Károlyi karolyi

🏠
Working from home
View GitHub Profile
@karolyi
karolyi / backup-mariadb.sh
Last active April 19, 2023 12:14
Fast backup/restore mysql databases
#!/usr/bin/env bash
mariabackup --stream=xbstream --backup --user root|pigz >mariadb-backup.gz
#!/usr/bin/env bash
STATE='ON'
if [[ $1 == 'off' ]]; then
STATE='OFF'
fi
STR_1='<?xml version="1.0" encoding="UTF8"?><SMARTPLUG id="edimax"><CMD id="setup"><Device.System.Power.State>'
STR_2='</Device.System.Power.State></CMD></SMARTPLUG>'
@karolyi
karolyi / config.fish
Last active October 29, 2022 13:10
My fish-shell settings
# Path to Oh My Fish install.
set -q XDG_DATA_HOME
and set -gx OMF_PATH "$XDG_DATA_HOME/omf"
or set -gx OMF_PATH "$HOME/.local/share/omf"
# Customize Oh My Fish configuration path.
#set -gx OMF_CONFIG /Users/laszlokarolyi/.config/omf
# Reload user_abbreviations by executing:
. ~/.config/fish/abbreviations/fish_user_abbreviations.fish
@karolyi
karolyi / osx_keyboardspeed.sh
Created November 19, 2015 20:54
Mac OS X super fast keyboard speed
#!/usr/bin/env bash
# http://papers.ch/speeding-up-your-mac-osx-terminal-input/
#echo "Disable press-and-hold for keys in favor of key repeat"
#defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
echo "Set a blazingly fast keyboard repeat rate"
defaults write NSGlobalDomain KeyRepeat -int 0.02
@karolyi
karolyi / start-jackd.sh
Last active February 6, 2022 10:57
Start jackd properly
#!/usr/bin/env bash
set -x
killall -9 jackdbus
qjackctl &
sleep 2
while true;
do
@karolyi
karolyi / pacman-autoremove.sh
Created October 22, 2021 11:25
pacman autoremove
#!/usr/bin/env sh
pacman -Rs $(pacman -Qtdq)
@karolyi
karolyi / pip_update.sh
Last active September 13, 2020 16:54
Script to update all PIP packages to latest version, with a user installed PIP
#!/usr/bin/env sh
# Packages necessary on ubuntu: python3-pip
USED_PYTHON_BINARY="python3.7"
set -x
# Install/update basic package handling tools
$USED_PYTHON_BINARY -m pip install --user -U pip wheel setuptools
@karolyi
karolyi / activate.fish
Last active July 10, 2020 17:43
Set PYTHONEXECUTABLE for OSX/DARWIN Homebrew Python venv
# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org)
# you cannot run it directly
# --- $PYTHONEXECUTABLE SETTING: See https://stackoverflow.com/a/53190037/1067833 ---
function deactivate -d "Exit virtualenv and return to normal shell environment"
# reset old environment variables
if test -n "$_OLD_VIRTUAL_PATH"
set -gx PATH $_OLD_VIRTUAL_PATH
set -e _OLD_VIRTUAL_PATH
@karolyi
karolyi / pkgmirror-revalidator.py
Created May 3, 2020 10:15
Revalidating nginx reverse-proxied FreeBSD pkg mirrors
#!/usr/bin/env python3.7
from argparse import ArgumentParser
from hashlib import sha256
from http.client import HTTPResponse
from io import BytesIO
from json import loads
from pathlib import Path
from subprocess import check_output
from sys import exit
@karolyi
karolyi / termin.sh
Last active December 16, 2019 12:48
Best appointment date finder for the Berlin authorities
#!/usr/bin/env bash
RETCODE=1
# Change the URL in the curl commandline for yourself.
while [[ $RETCODE == 1 ]]; do
echo -n "$RANDOM ... "
OUT=$(curl -gs "https://service.berlin.de/terminvereinbarung/termin/tag.php?termin=1&anliegen[]=121598&dienstleisterlist=122210,122217,122219,122227,122231,122238,122243,122252,122260,122262,122254,122271,122273,122277,122280,122282,122284,122285,122286,122296,150230,122301,122297,122294,122312,122314,122304,122311,122309,317869,324433,325341,324434,122281,122276,122274,122267,122246,122251,122257,122208,122226,121646&herkunft=http%3A%2F%2Fservice.berlin.de%2Fdienstleistung%2F121598%2F&asd=$RANDOM"|grep '"buchbar'|head -1|grep 'datum=2015-10')
RETCODE=$?