Skip to content

Instantly share code, notes, and snippets.

@belst
belst / LICENSE
Last active September 24, 2024 21:36
MIT License
Copyright (c) 2024 belst
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
// ==UserScript==
// @name Youtube shorts redirect
// @namespace Violentmonkey Scripts
// @match *://*.youtube.com/*
// @grant none
// @version 1.0
// @author belst
// @description 9/22/2022, 1:26:47 PM
// ==/UserScript==
@belst
belst / index.html
Last active February 6, 2019 16:30
Visualization of env data
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Weather API</title>
<style>
body {
margin: 0 auto;
#!/usr/bin/env bash
SERVERNAME="${SERVERNAME:-B44Server1}";
SERVERHOME="${SERVERHOME:-/home/bt44/LinuxServer}";
STARTSCRIPT="${STARTSCRIPT:-Run.sh}";
screen -dmS "$SERVERNAME" bash -c "cd $SERVERHOME; until ./$STARTSCRIPT; do echo 'Server crashed. Restarting...'; done;";
@belst
belst / rocketguide.md
Last active March 13, 2024 22:09
Deploy Rocket in production

Deploy Rocket using Letsencrypt and nginx

Information

This guide uses the domain your-domain.tld and its www. prefixed version. It starts the rocket application on 127.0.0.1:1337 and as the user www-data. The proxy listens on port 80 and 443 though.
If you need other values, update them accordingly in your nginx and systemd configs.

Prerequisites

You need to have nginx, certbot and rust installed.

@belst
belst / backuphome.sh
Last active April 15, 2019 14:25
Incremental rsync backup script
#!/usr/bin/env bash
SOURCE=/home/belst/
TARGET="backup:~/backup/home/belst/" # Trailing / is needed
TODAY=$(date +%Y-%m-%d)
ssh backup mkdir -p "${TARGET#*:}${TODAY}"
rsync -avR --delete "${SOURCE}" "${TARGET}${TODAY}/" --link-dest="${TARGET#*:}last"
ssh backup ln -nsf "${TARGET#*:}${TODAY}" "${TARGET#*:}last"
@belst
belst / monky.hs
Last active April 9, 2017 09:00
Config for github.com/monky-hs/monky
{-# LANGUAGE OverloadedStrings #-}
import Monky
import Monky.Modules
import Monky.Examples.Sound.Alsa
import Monky.Examples.CPU
import Monky.Examples.Memory
import Monky.Examples.Time
import Monky.Examples.Battery
import Monky.Examples.Disk
// ==UserScript==
// @name Crates.io Readme
// @namespace https://bel.st/
// @version 0.1
// @description loads Readme files from github and displays them in the crate info area
// @author belst
// @match https://crates.io/crates/*
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
// ==/UserScript==
@belst
belst / keybase.md
Last active February 13, 2018 14:53

Keybase proof

I hereby claim:

  • I am belst on github.
  • I am belst (https://keybase.io/belst) on keybase.
  • I have a public key ASAc2YKUIPP9fnR1aq3gaCE4giPzWlqBPLTHKX2Hb2LVMgo

To claim this, I am signing this object:

@belst
belst / inlineClient.sh
Created March 28, 2016 15:46
Inlines Cert and Key files into open vpn config
#!/usr/bin/env bash
IP=$(hostname -I | cut -f1 -d' ');
if [ -z "$1" ]; then
echo "usage: $0 <configname>";
exit 1;
fi;
echo 'Adding IP and creating config';