Skip to content

Instantly share code, notes, and snippets.

View keyboardcrunch's full-sized avatar

keyboardcrunch keyboardcrunch

View GitHub Profile
@keyboardcrunch
keyboardcrunch / proxy_crazy.conf
Created November 22, 2024 03:53
Nginx wildcard subdomain, map and upstream example
# Setup an "upstream" to allow preferences between local or tailscale endpoints for an Ollama service
# Note: I'm running a similar config on my laptop so I can access services while local or remote but
# use upstream to pick the endpoint to use.
upstream chat {
ip_hash;
server 192.168.1.3:11434;
server 100.44.39.165:11434;
}
# Setup a map to associate our proxy endpoint with the subdomain
@keyboardcrunch
keyboardcrunch / proxy_ollama.conf
Created September 25, 2024 00:29
Nginx proxy Ollama load balancer
# Listen on 11434 and proxy requests to a local Ollama server, either by local network or tailscale.
# ip_hash should maintain sessions while upstream handles one being offline.
# upstream 'load balancing' is used to maintain connectivity while working remote.
upstream ollama {
ip_hash;
server 192.168.1.166:11434;
server 100.94.79.62:11434;
}
@keyboardcrunch
keyboardcrunch / remoteOne.yml
Last active April 30, 2024 01:05
esphome - esp32s3 - 3 button wifi remote
# Device configuration
esphome:
name: "remoteOne"
friendly_name: RemoteOne
esp32:
board: esp32-s3-devkitc-1
framework:
type: arduino
@keyboardcrunch
keyboardcrunch / db.ts
Created October 17, 2023 19:53
Weather service backend for 3rd party clients to present bike-nobike weather conditions.
const kv = await Deno.openKv();
export interface BikeStatus {
bike: boolean,
temp: number,
uv: number,
rain: number,
sunset: string,
sunrise: string
};
@keyboardcrunch
keyboardcrunch / deno.json
Last active February 5, 2024 11:30
MastoJs with Deno
{
"imports": {
"masto": "https://cdn.skypack.dev/masto@6.1.0?dts"
}
}
@keyboardcrunch
keyboardcrunch / blockmetatwitter.md
Created June 28, 2023 20:15 — forked from dangovorenefekt/blockmetatwitter.md
Block Meta and Twitter (nginx)
@keyboardcrunch
keyboardcrunch / example.rss
Last active June 15, 2023 02:00
Deno code to create an rss feed of public entries from the sqlite database of a Shiori bookmark server.
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>keyboardcrunch - recently read</title>
<link>https://blog.keyboardcrunch.com/</link>
<description>A list of stuff I found interesting or look forward to reading.</description>
<lastBuildDate>Thu, 15 Jun 2023 01:59:18 GMT</lastBuildDate>
<docs>https://validator.w3.org/feed/docs/rss2.html</docs>
<generator>https://github.com/jpmonette/feed</generator>
<item>
@keyboardcrunch
keyboardcrunch / managed_policy.json
Created June 1, 2023 23:19
Chrome Enterprise Linux policy - allows all hosted extensions and uBlock-Origin
# Allows install of any locally hosted extensions, restricts webstore extensions without explicit allow.
{
"HomepageLocation": "https://www.google.com",
"HomepageIsNewTabPage": false,
"ExtensionSettings": {
"*": {
"installation_mode": "blocked",
"blocked_install_message": "Extension installation is restricted to reviewed and approved only.",
"blocked_permissions": [],
"install_sources": [
@keyboardcrunch
keyboardcrunch / disable_winsvc.ps1
Last active May 17, 2023 01:21
Windows Services to disable
$ServiceList = @'
diagtrack
dusmsvc
dps
wdiservicehost
wdisystemhost
mapsbroker
fhsvc
GoogleChromeElevationService
gupdate

Nginx mTLS Setup

This configuration will setup an Nginx server that requires a valid client certificate for mutual tls. We'll cover some basic certificate setup, the nginx config, and some openssl conversions for browser certificate import.

Certificate Setup

Creating the Certificates Manually

Create the CA

openssl genrsa -out ca.key 4096
openssl req -new -x509 -key ca.key -out ca.crt