Skip to content

Instantly share code, notes, and snippets.

View hiway's full-sized avatar

Harshad Sharma hiway

View GitHub Profile
@hiway
hiway / 01-brainstorm-trooper.chatmode.md
Created July 26, 2025 16:46
Hiway's Copilot Chatmodes
description tools
Brainstorm Trooper
changes
codebase
editFiles
fetch
findTestFiles
problems
search
searchResults
terminalLastCommand
terminalSelection
usages
websearch

Helps user identify and invalidate incorrect assumptions in their code, logic, or approach. This mode is tuned for:

  • Generating and exploring initial ideas
  • Brainstorming multiple approaches or solutions
  • Questioning and surfacing assumptions (both explicit and implicit)
  • Encouraging open-ended exploration and creative thinking
@hiway
hiway / config_validate.ex
Last active April 15, 2024 11:33
Elixir snippets for writing libraries
defmodule ConfigValidate do
def ensure_value_is_not_nil(key, value, suggestion) do
if value == nil do
raise """
Please set #{key} under mix.exs project configuration.
def project do
[
...
#{suggestion}
@hiway
hiway / freedive.ex
Created April 11, 2024 22:42
Elixir module to execute commands on FreeBSD, using doas and inside jails.
defmodule Freedive do
@moduledoc """
Freedive: Dive into FreeBSD.
"""
@doas_path "/usr/local/bin/doas"
@jexec_path "/usr/sbin/jexec"
@env_path "/usr/bin/env"
@env_path_var "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
@doc """
@hiway
hiway / README.md
Created July 2, 2023 06:50
Intermittent freezes/hangs - Fedora Linux 38 on Thinkpad X280
@hiway
hiway / main.py
Last active June 17, 2023 20:20
Quasar Rating element for NiceGUI
#!/usr/bin/env python3
from nicegui import Client, ui
from rating import Rating
@ui.page("/")
async def main(client: Client):
def score_changed(event):
stars = int(event['args'])
wid_rating.props(f"value={stars}")
@hiway
hiway / freebsd-tailscale-vpn.sh
Last active April 23, 2024 13:35
Script to set up FreeBSD 13 VPS as a Tailscale VPN Exit Node
#!/bin/sh
#
# freebsd-tailscale-vpn.sh
#
# MIT License
#
# Copyright (c) 2023 Harshad Sharma
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@hiway
hiway / quartsio.py
Created April 3, 2023 07:13
Python Quart + SocketIO Async Server
import asyncio
import socketio
import uvicorn
from quart import Quart
from quart_cors import cors
CORS_ALLOWED_ORIGINS = "*"
@hiway
hiway / example_hasspy_tplink_4g_modem.py
Last active March 13, 2023 23:20
Example Python program to publish text messages received on a TP-Link MR200 4G modem to Home Assistant. Note: this example is incomplete as the modules "hasspy" and "tplink_mr200" have not been released yet.
@hiway
hiway / Caddyfile
Last active November 20, 2022 09:01
Caddyfile for Mastodon 3.x and 4.x that also maps @[email protected] -> @[email protected]
example.com {
header /.well-known/host-meta Access-Control-Allow-Origin *
respond /.well-known/host-meta `https://mastodon.example.com{uri}`
@webfinger {
path /.well-known/webfinger*
}
reverse_proxy @webfinger {
to http://localhost:3000
@hiway
hiway / mastodon_domain_blocks.py
Last active November 9, 2022 19:54
Mastodon Domain Blocks WebUI
"""
# Mastodon Domain Blocks
## Install
```
python -m venv venv
source venv/bin/activate
pip install click mastodon.py streamlit watchdog