Skip to content

Instantly share code, notes, and snippets.

@belst
belst / index.html
Last active Feb 6, 2019
Visualization of env data
View index.html
<!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;
View b44start.sh
#!/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 Feb 8, 2021
Deploy Rocket in production
View rocketguide.md

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 Apr 15, 2019
Incremental rsync backup script
View backuphome.sh
#!/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 Apr 9, 2017
Config for github.com/monky-hs/monky
View monky.hs
{-# 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
View cratesreadme.user.js
// ==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==
View keybase.md

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 Mar 28, 2016
Inlines Cert and Key files into open vpn config
View inlineClient.sh
#!/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';