Skip to content

Instantly share code, notes, and snippets.

View hiway's full-sized avatar

Harshad Sharma hiway

View GitHub Profile
@hiway
hiway / be-minion-jail.sh
Created July 12, 2021 17:05
Run salt-minion in a Jailed Boot Environment on FreeBSD
#!/bin/sh
# Usage:
# First create a boot-environment with bectl:
# bectl create NAME
# Then run this script:
# be-minion-jail.sh BE-NAME
@hiway
hiway / README.md
Last active April 23, 2024 13:12
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
hiway / mr600.py
Created January 29, 2020 16:40
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 microblog.pub 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 192.168.10.1/24"
@hiway
hiway / hiwaysshrc.sh
Last active May 12, 2022 21:25
My sshrc dofile to carry a custom bash prompt to remote *nix with ssh/mosh access.
#!/usr/bin/env bash
##
## hiwaysshrc.sh
## --------------------------------------------------
##
## Install:
##
## $ ln -s $(pwd)/hiwaysshrc.sh ~/.sshrc
## $ echo "source ~/.sshrc" >> ~/.bash_profile
##
@hiway
hiway / README.md
Last active February 12, 2018 14:54
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
hiway / ubloom.py
Created August 3, 2017 20:10
A lightweight bloom filter for Micropython and Python 3 with a tiny memory footprint.
# coding=utf-8
try:
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
@hiway
hiway / README.md
Last active June 18, 2017 20:42
Multi-worker uvicorn on single machine: LocalBroadcast middleware uses redislite to run embedded redis server w/ unix pipes (no network server)

Installation / Dependencies

Get these files on your machine.

$ pip install uvicorn

Usage

@hiway
hiway / zmq_http_server_example.py
Last active July 11, 2020 06:53 — forked from malexer/zmq_http_server_example.py
Hello World HTTP server in pyzmq (using ZeroMQ RAW socket) - a Python3.5+ version of http://gist.github.com/hintjens/5480625
# coding=utf-8
import zmq
DEFAULT_PAGE = '\r\n'.join([
"HTTP/1.0 200 OK",
"Content-Type: text/plain",
"",
"Hello, World!",
])

Keybase proof

I hereby claim:

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

To claim this, I am signing this object: