Skip to content

Instantly share code, notes, and snippets.

View VSharapov's full-sized avatar
☁️
Tiny webapps on free tier - https://news.ycombinator.com/item?id=26242844

Vasiliy Sharapov VSharapov

☁️
Tiny webapps on free tier - https://news.ycombinator.com/item?id=26242844
  • rotor.ai
  • Boston, MA
  • 11:29 (UTC -05:00)
View GitHub Profile
@VSharapov
VSharapov / README.md
Created October 9, 2025 19:37
Sample ed25519 keypair - do not use

ed25519 keypair

It's on the public web. Anyone can get access to the private key. Do not use this for anything.

...I'm just testing stuff and it's an easy little hack.

@VSharapov
VSharapov / sanity-test-docker-cp.sh
Last active September 16, 2025 15:20
Will docker cp overwrite stuff on the destination as expected?
#!/usr/bin/env bash
for test in "bare file" "directory"; do
prefix=""
container_path="/foo"
if [ "$test" = "directory" ]; then
mkdir -p "/tmp/foodir"
prefix="/foodir"
container_path="/foodir"
fi
#!/usr/bin/env bash
x=$(mktemp --suffix=.py)
curl -L https://github.com/9001/copyparty/releases/latest/download/copyparty-sfx.py -o "$x"
python "$x"
rm -i "$x"
@VSharapov
VSharapov / password_change_manually.sh
Created June 6, 2025 21:42
If there's no `passwd` or `chpasswd` try this jank
#!/bin/sh
set -eu
# DEBUG=true
DEBUG=false
if $DEBUG; then
trap 'echo "# $BASH_COMMAND";read' DEBUG
fi
@VSharapov
VSharapov / gitlabRunnerGracefullExit.sh
Created May 28, 2025 15:40
Send gitlab-runner main PID a SIGQUIT and wait for jobs to finish
#!/usr/bin/env bash
sudo kill -SIGQUIT $(systemctl show gitlab-runner.service -p MainPID | cut -d= -f2) && \
while systemctl is-active gitlab-runner.service ; do sleep 2; done
@VSharapov
VSharapov / gitsplz.sh
Last active June 6, 2025 19:19
Pick a gist and run it
#!/bin/sh
set -eu
tmp_file=$(mktemp) && echo -e '#!/bin/sh\nexit 0' > "$tmp_file" && chmod +x "$tmp_file" && "$tmp_file" || tmp_file=$(mktemp -p "$HOME") || exit 1
gists=$(curl -s https://api.github.com/users/VSharapov/gists | jq -r '.[].files[].raw_url')
[ -z "$gists" ] && exit 1
selected_gist=$(echo "$gists" | fzf) || select selected_gist in $gists; do break; done
curl -s "$selected_gist" -o "$tmp_file" && chmod +x "$tmp_file" && "$tmp_file" "@"
rm -i "$tmp_file"
@VSharapov
VSharapov / inhibitLidOnce.sh
Created February 18, 2025 23:19
Inhibit lid switch until reboot
#!/usr/bin/env bash
sudo systemd-inhibit --what=handle-lid-switch --mode=block sleep 9999d & disown
@VSharapov
VSharapov / make_sudo_passwordless.sh
Created February 18, 2025 22:50
Make sudo passwordless for current user
#!/usr/bin/env bash
echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/$USER > /dev/null
@VSharapov
VSharapov / listAccessibleMachines.sh
Created November 6, 2024 18:42
Try a set of credentials on all machines in a set of subnets
#!/usr/bin/env bash
### recommended usage is something like:
### export PARAM_SUBNETS="10.69.0.0/16 192.168.1.0/24"; export PARAM_USERNAME=ubuntu; [ -z "$PARAM_PASSWORD" ] && { read -s ; export PARAM_PASSWORD="$REPLY" ; } ; ./listAccessibleMachines.sh
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
@VSharapov
VSharapov / Persistent reverse SSH tunnel.md
Created September 30, 2024 04:56 — forked from Duckle29/Persistent reverse SSH tunnel.md
A systemd service file to ensure a persistent reverse SSH tunnel is active

Persistent reverse-ssh-tunnel systemd unit

This unit file, if enabled on boot, will attempt to connect to a remote server and establish a reverse tunnel. It uses StrictHostKeyChecking=accept-new for the ssh connection, so if you want to make sure the host you're connecting to is the right one, carry out the first connection manually and check the key.

REMOTE is considered a remote server that's available over ssh
LOCAL is considered the device initiating the remote tunnel. This will likely be a device dropped behind a NAT with no option of portforwarding

To use it, copy this multiline command somewhere to edit the configs and run it as root on the device: