Skip to content

Instantly share code, notes, and snippets.

# -a archive, -v verbose, -h human-units, -W whole file (less cpu for delta algo), --no-compress because there's bandwith, --no-inc-recursive more ram but does a good estimate
rsync -avhW --no-compress --info=progress2 --no-inc-recursive <src> <dst>
@luminoso
luminoso / set_inhibited.sh
Created May 15, 2024 10:56
Sets KDE plasma 6 Inhibited (do not disturb) state by command. Useful for fokus
#!/bin/bash
# Sets KDE plasma 6 Inhibited (do not disturb) state by command
toogle() {
qdbus-qt6 org.kde.kglobalaccel /component/plasmashell invokeShortcut "toggle do not disturb"
}
on_off() {
current_state=$(qdbus-qt6 org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.Inhibited)
@luminoso
luminoso / script.sh
Created October 27, 2022 08:08
bash script template
#!/usr/bin/env bash
# template source: https://news.ycombinator.com/item?id=33352967
set -o errexit
set -o nounset
set -o pipefail
if [[ -n "${TRACE-}" ]]; then
set -o xtrace
fi
import logging
from typing import Any, Optional, Union
from uuid import uuid4
from starlette.requests import HTTPConnection, Request
from starlette.responses import Response
from starlette.types import Message
from starlette_context import context
from starlette_context.plugins import Plugin
@luminoso
luminoso / exportSpreadsheet.gs
Created October 29, 2021 13:12 — forked from Spencer-Easton/exportSpreadsheet.gs
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
@luminoso
luminoso / kubectx_zinit.sh
Created April 21, 2021 08:37
kubectx zinit install
git clone https://github.com/ahmetb/kubectx.git
cd kubectx
#COMPDIR=$(pkg-config --variable=completionsdir bash-completion)
COMPDIR=$HOME/.zinit/completions
ln -s $(pwd)/completion/kubectx.zsh $COMPDIR/_kubectx.zsh
ln -s $(pwd)/completion/kubens.zsh $COMPDIR/_kubens.zsh
cd cmd/kubect
go build
@luminoso
luminoso / borg.txt
Last active October 26, 2023 17:02
Borg exclusion list
*/CachedData
*/CacheStorage
*/.cargo
*/.ccache
*/.[Cc]ache
*/[Cc]ache
*/.conda
*/.config/BraveSoftware/Brave-Browser-Beta
*/.config/BraveSoftware/Brave-Browser-Nightly
*/.config/Code/logs
./i2pd --log stdout \
--loglevel info \
--port 20750 \
--host $(curl -s https://api.ipify.org) \
--nat 0 \
--floodfill \
--bandwidth X \
--limits.openfiles 8192 \
--limits.transittunnels 2500 \
--limits.ntcpsoft 192 \
@luminoso
luminoso / .zshrc
Created October 14, 2020 15:50
zinit zshrc
### Added by Zinit's installer
if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then
print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f"
command mkdir -p "$HOME/.zinit" && command chmod g-rwX "$HOME/.zinit"
command git clone https://github.com/zdharma/zinit "$HOME/.zinit/bin" && \
print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \
print -P "%F{160}▓▒░ The clone has failed.%f%b"
fi
@luminoso
luminoso / mtg.service
Last active January 10, 2021 10:18
[mtg.service] #mtg #systemd #proxy #service
[Unit]
Description=mtproxy
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
ExecStart=/opt/mtg run -v -w 128KB -r 128KB --prefer-ip ipv6 --cloak-port 993 -b 0.0.0.0:443 ee5c557d37ddde51c21d4577a29b88bbcc6d747072782e6e6f772e696d
AmbientCapabilities=CAP_NET_BIND_SERVICE
Restart=never