Skip to content

Instantly share code, notes, and snippets.

@spacegaucho
spacegaucho / tampermonkey-refresh-page.js
Last active October 27, 2025 04:31
Violent/TamperMonkey script to refresh a page on interval
// ==UserScript==
// @name Auto-Refresh with Overlay (Pause + Hover Info)
// @match *://x.com/*
// @version 0.5
// @description Checks inactivity and reloads the page after a set time interval, showing a countdown overlay with pause/resume toggle and hover hint.
// ==/UserScript==
// Vibecoded... I don't claim to know much about frontend or js, it works and I'm happy 👍
// Adds a timer that can be tweaked to refresh x.com (can be changed to whatever you like with `@match`.
// The remaining time before refresh is shown as an overlay with transparency on the top left corner.
#!/bin/bash
# DESCRIPTION: Install/setup minimum customization for bash.
# export the desired value before installing
VIM_BASH_ONLY=${VIM_BASH_ONLY:-0}
INSTALL_STARSHIP=${INSTALL_STARSHIP:-1}
install_workstuff() {
# Apt stuff
DEBIAN_FRONTEND=noninteractive
@spacegaucho
spacegaucho / vimrc
Last active June 3, 2022 15:52 — forked from meskarune/vimrc
simple functional vim status line - jellybeans theme colors
" basic stuff
execute pathogen#infect()
" status bar colors
au InsertEnter * hi statusline guifg=black guibg=#d7afff ctermfg=black ctermbg=magenta
au InsertLeave * hi statusline guifg=black guibg=#8fbfdc ctermfg=black ctermbg=cyan
hi statusline guifg=black guibg=#8fbfdc ctermfg=black ctermbg=cyan
" Status line
" default: set statusline=%f\ %h%w%m%r\ %=%(%l,%c%V\ %=\ %P%)
@spacegaucho
spacegaucho / krewcurlinstall.sh
Created March 10, 2022 00:11
kubectl krew install via curl
(
set -x; cd "$(mktemp -d)" &&
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew
echo 'export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"'>> ${HOME}/.bashrc
)
@spacegaucho
spacegaucho / ddwrt-ovpn_restart.sh
Created February 12, 2021 00:45
Script that checks for good ddwrt openvpn connection. Sometimes ISPs change IPs, even if my dynDNS system reflects the change openvpn doesn't. This is a quick work around.
# Set this up as startup script
sleep 60
while true; do
if ps | grep -v grep | grep -q openvpn; then
if ! ping -qc3 www.xxx.yyy.zzz 2>&1 1>/dev/null; then
killall openvpn
sleep 2
openvpn --config /tmp/openvpncl/openvpn.conf --daemon
logger "WARNING: Restarted openvpn due to connection problems"
fi
@spacegaucho
spacegaucho / ssh
Last active January 17, 2018 14:18
Bash completion for ssh
# Store in /etc/bash_completion.d/ssh
# Create a ~/.ssh/hosts file that includes the hostnames you want to autocomplete
# Example: `Host hostname`
# Found this idea here https://unix.stackexchange.com/a/181603
_ssh()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@spacegaucho
spacegaucho / trackUPS.sh
Created June 11, 2017 01:08
Track UPS with bash
#!/bin/bash
TRACK='TRACKING_CODE_GOES_HERE'
PAGE_RESPONSE=`curl -i -X POST -d "loc=en_US&HTMLVersion=5.0&USER_HISTORY_LIST=&trackNums=$TRACK&track.x=Track" https://wwwapps.ups.com/WebTracking/track 2>/dev/null`
clear ; grep -A 30 'Last Location:' <(echo "$PAGE_RESPONSE") | tr '\n\r\t' ' ' | sed -e 's/<dd>//g' -e 's/&nbsp;//g' -e 's/<\/dt>//g' -e 's/<\/lablel>//g' -e 's/<dt>//g' -e 's/<\/label>//g' -e 's/<\/dl>//g' -e 's/<\/dd>//g' -e 's/<label for="">//g' | tr -s ' 'i; echo -e "\r"
grep -A 20 'Scheduled Delivery:' <(echo "$PAGE_RESPONSE") | tr '\n\r\t' ' ' | sed -e 's/&nbsp;//g' -e 's/<dd>//g' -e 's/<dl>//g' -e 's/<label>//g' -e 's/<\/dt>//g' -e 's/<\/lablel>//g' -e 's/<dt>//g' -e 's/<\/label>//g' -e 's/<\/dl>//g' -e 's/<\/dd>//g' -e 's/<label for="">//g' | tr -s ' '
echo;exit 0
@spacegaucho
spacegaucho / xenial-lxc-container.sh
Created June 11, 2017 01:05
Simple bash script for unprivileged lxc container
#!/bin/bash
# This script must be run as the desired user
# The container name will be $USER for simplicity
# For this to work you need to sudo su <user>, else lxc wont work
# Add subuids/gids
sudo usermod --add-subuids 100000-165536 $USER
sudo usermod --add-subgids 100000-165536 $USER
# LXC Config for user
mkdir -p ~/.config/lxc