Skip to content

Instantly share code, notes, and snippets.


Harshad Sharma hiway

View GitHub Profile
hiway / Caddyfile
Last active Nov 20, 2022
Caddyfile for Mastodon 3.x and 4.x that also maps ->
View Caddyfile {
header /.well-known/host-meta Access-Control-Allow-Origin *
respond /.well-known/host-meta `{uri}`
@webfinger {
path /.well-known/webfinger*
reverse_proxy @webfinger {
to http://localhost:3000
hiway /
Last active Nov 9, 2022
Mastodon Domain Blocks WebUI
# Mastodon Domain Blocks
## Install
python -m venv venv
source venv/bin/activate
pip install click streamlit watchdog
hiway /
Last active Oct 28, 2022
Streamlit Demo - WebUI to generate/access SSH key-pairs for hosts.
from pathlib import Path
from typing import List
import pyperclip
import streamlit as st
from plumbum import local
SSH_KEYS_DIR = "~/.ssh/keys"
# --- API ---
hiway /
Created Jul 12, 2021
Run salt-minion in a Jailed Boot Environment on FreeBSD
# Usage:
# First create a boot-environment with bectl:
# bectl create NAME
# Then run this script:
hiway /
Last active Feb 22, 2022
Creating a single process FreeBSD (12.1) Jail

How to jail a single process web server on FreeBSD 12.1

You may have found many great resources on how to set up jails on latest FreeBSD, however there is scant information on how to go about creating a barebones jail with nothing but the one process that you want to isolate.

I was curious if I could contain a statically compiled web server that I wrote while learning Rust all by itself in a jail instead of having a full userland.

hiway /
Created Jan 29, 2020
Fetch and save SMS from Tp-Link Archer MR600 4G Router using Selenium and Firefox to SQLite database.
#!/usr/bin/env python3
import datetime
import logging
import os
import peewee
import time
from collections import namedtuple
from selenium import webdriver

Installing in a FreeBSD 12.1 (iocage) jail

sysrc ifconfig_vtnet0_name="public"
sysrc ifconfig_public="DHCP"

sysrc cloned_interfaces="bridge0"
sysrc ifconfig_bridge0_name="private"
sysrc ifconfig_private="inet"
hiway /
Last active May 12, 2022
My sshrc dofile to carry a custom bash prompt to remote *nix with ssh/mosh access.
#!/usr/bin/env bash
## --------------------------------------------------
## Install:
## $ ln -s $(pwd)/ ~/.sshrc
## $ echo "source ~/.sshrc" >> ~/.bash_profile
hiway /
Last active Feb 12, 2018
Automatically suspend selcted apps when not in use.

MacOS App Auto-Suspend

This is a quick hack to test whether a Python script can manage suspending and resuming other applications on MacOS. This version is a draft and has been tested for a few hours on MacOS El Capitan, your mileage may vary.

The script should be run with system python, if you have installed another copy with brew or another manager,

hiway /
Created Aug 3, 2017
A lightweight bloom filter for Micropython and Python 3 with a tiny memory footprint.
# coding=utf-8
import urandom as _random
import uhashlib as _hashlib
import ubinascii as _binascii
except ImportError:
import random as _random
import hashlib as _hashlib
import binascii as _binascii