Skip to content

Instantly share code, notes, and snippets.

View SharkyRawr's full-sized avatar
🦄
Rawr

Sophie SharkyRawr

🦄
Rawr
View GitHub Profile
/* Edited by IntelligentComment
/* Moderator tag */
.thing .tagline .author.friend {
padding: 1px 8px;
border-radius: 10px;
background-color: red;
@SharkyRawr
SharkyRawr / authkeys_to_sha256.sh
Created February 5, 2019 11:55
Convert OpenSSH authorized_keys entries in to sha256 sums used in /var/log/auth.log
#! /bin/bash -ex
while read p; do
echo -e "\n$p ->"
echo $p | awk '{ print $2 }' | # Only the actual key data without prefix or comments
base64 -d | # decode as base64
sha256sum | # SHA256 hash (returns hex)
awk '{ print $1 }' | # only the hex data
xxd -r -p | # hex to bytes
base64 # encode as base64
done < /root/.ssh/authorized_keys
#! /bin/bash
DUPLICITY="/usr/local/bin/duplicity"
KEY="YOUR-GPG-KEY-HERE"
DEST="b2://something@somebucket/" # or whatever other destination you fancy
test -x "$DUPLICITY" || exit -1
. /root/.duplicity # GPG passphrase goes here for automatic encryption
# /root/.duplicity content like:
# export PASSPHRASE="my really secure password"
@SharkyRawr
SharkyRawr / vscodehere.desktop
Last active June 11, 2024 19:13
KDE 5 Plasma Service Menu action: VSCode here (open visual studio code in current directory for KDE Plasma)
# Install in to ~/.local/share/kservices5/vscodehere.desktop
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
MimeType=inode/directory;
Actions=openVSCodeHere;
X-KDE-AuthorizeAction=shell_access
[Desktop Action openVSCodeHere]
@SharkyRawr
SharkyRawr / rc.local.sh
Created December 22, 2018 08:53
Dont block my server plz Hetzner plz
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#! /bin/bash
# See ssh -Q cipher (on both machines)
CIPHERS="[email protected] aes128-ctr aes192-ctr aes256-ctr [email protected] [email protected]"
# Destination server (data will be piped to /dev/null)
DESTINATION="[email protected]"
for cipher in ${CIPHERS} ; do
for i in 1 2 3 ; do
@SharkyRawr
SharkyRawr / sort.py
Created May 28, 2018 13:11
steam screenshot sorting script
"""
made by Sharky - https://sharky.pw/
"""
import os, re, shutil
from requests import get
r = get('http://api.steampowered.com/ISteamApps/GetAppList/v2')
apps = r.json()['applist']['apps']
#! /bin/bash -e
cat /var/lib/misc/dnsmasq.leases | awk '{split($0,a," "); if (a[4] != "*") { print a[3],"\t",a[4]}}'
apt install -y pbzip2 pigz pixz
for f in gzip gunzip gzcat; do
ln -sv "`which pigz`" "/usr/local/bin/$f"
done
for f in bzip2 bunzip bzcat; do
ln -sv "`which pbzip2`" "/usr/local/bin/$f"
done
for f in xz xzcat; do
@SharkyRawr
SharkyRawr / duplicity_backup.sh
Created April 29, 2018 19:01
B2 full-system backup using duplicity with gnupg
#! /bin/bash -e
# pro-tip: This script is designed to be called from cron.daily and will only output a short report,
# which can be mailed to you if you add an email for root in /etc/aliases -
# or it can be called directly: './duplicity_backup.sh -vi' - which will show the changes for each file
DUPLICITY="/usr/local/bin/duplicity"
KEY="your-gnupg-keyid-here"
DEST="b2://your-b2-account-id:your-b2-application-key@your-b2-bucket/"