Skip to content

Instantly share code, notes, and snippets.

# fixup_apm_uri.irule
# bill church - bill@f5.com
# 20180928 - initial release
#
# If a URI length is equal or greater than 4095 bytes
# store in a variable, replace uri temporairly, before
# APM and re-inject stored URI after APM
#
# Optional "URIFixup" header for troubleshooting
# and debug can be removed.
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
const request = require('request')
const url = makeurl(4094)
request('https://192.168.20.46/' + url, function (error, response, body) {
console.log('error:', error) // Print the error if one occurred
console.log('statusCode:', response && response.statusCode) // Print the response status code if a response was received
console.log('body:', body) // Print the HTML for the Google homepage.
@billchurch
billchurch / http_echo.js
Created September 28, 2018 11:49
HTTP echo server in node
const http = require('http')
const server = http.createServer((req, res) => {
let response = `URL(${req.url.length}): ${req.url}\r\nHeaders: ${JSON.stringify(req.headers)}\r\n\r\n`
res.end(response)
console.log(response)
})
server.on('clientError', (err, socket) => {
socket.end('HTTP/1.1 400 Bad Request\r\n\r\n')
@billchurch
billchurch / Index.js
Created April 17, 2019 16:05
PoC to verify cert with node-forge from cli
const fs = require('fs'), pki = require('node-forge').pki
var ca = pki.certificateFromPem(fs.readFileSync('ca.pem', 'ascii'))
var client = pki.certificateFromPem(fs.readFileSync('client.pem', 'ascii'))
try {
if (!ca.verify(client)) throw 'verify failed'
} catch (err) {
console.log(err)
}
@billchurch
billchurch / web-servers.md
Created October 30, 2019 14:25 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
# Carro Home Daisy Smart Fan with replaced ESP-12 wifi chip #1006938428 #318843266
# Store link: https://tinyurl.com/yp44ux4w
# Story here: http://1projectaweek.com/blog/2022/2/8/converting-a-carro-home-dc-fan-to-esp-home
substitutions:
device_name: penfan
device_description: Penelope's Ceiling Fan
friendly_name: Penelope Fan
esphome:
@billchurch
billchurch / newbigip.sh
Last active August 9, 2023 14:14
A simple script that builds a template on Proxmox VE v7.x from a qcow2 image and provides some customization
newbigip.sh
#!/bin/bash
# This script will:
# - Create a 2 core 4096MB BIG-IP virtual machine
# - Install the image specified
# - Customize the image by loading bootstrap files to /config and
# expects:
# startup*
# .startup-env
@billchurch
billchurch / rect-starlink-cable-hack.md
Created August 16, 2022 12:01 — forked from darconeous/rect-starlink-cable-hack.md
Hacking the Rectangular Starlink Dishy Cable
@billchurch
billchurch / rtl_433_proxmox_docker_lxc.md
Last active May 15, 2024 17:14
rtl_433 proxmox lxc and docker
@billchurch
billchurch / sonos_unifi_discovery.py
Last active May 17, 2024 19:16
Python script to find all sonos units on your network with uPNP and then connect to a unifi switch to tell you what switch port they're on
import socket
import requests
import paramiko
import time
import xml.etree.ElementTree as ET
def discover_sonos_devices():
MCAST_GRP = '239.255.255.250'
MCAST_PORT = 1900
msg = (