Skip to content

Instantly share code, notes, and snippets.

View PeterHindes's full-sized avatar
💭
breaking nextjs

Peter Hindes PeterHindes

💭
breaking nextjs
View GitHub Profile
@PeterHindes
PeterHindes / README.md
Created March 14, 2025 19:30
Squares In Binary Visual Representation

This python file shows the values of the squares of n numbers in binary visualy, which reveals an intresting pattern.
It uses green (0, 255, 0) for '1' and red (255, 0, 0) for '0' and white for spaces that are unused because the length of the binary number is short. output

I would reccomend downloading the file and opening it with a program that lets you view the individual pixels. Below is a screenshot of a slice of the pattern.

image

@PeterHindes
PeterHindes / nginx.conf
Created September 18, 2024 18:46
Nginx Reverse Proxy a public ssl domain
events{}
http {
# serve synbiohub on port 7777
server {
listen 7777;
server_name localhost;
location / {
# Proxy to the new target URL without verifying SSL
@PeterHindes
PeterHindes / image-separator.py
Created December 15, 2023 20:24
PNG Image Separator/Island Isolator (useful for after effects animating png logos)
import cv2
import numpy as np
def save_components(image_path):
# Load the image with alpha channel
img = cv2.imread(image_path, cv2.IMREAD_UNCHANGED)
# Create a binary image where 0 indicates transparent pixels
_, alpha_bin = cv2.threshold(img[:,:,3], 0, 255, cv2.THRESH_BINARY)
@PeterHindes
PeterHindes / README.md
Created August 24, 2023 23:30
Cloudflare Router

Cloudflare simple router

Just put the method and path in a string mapped to a function in the routes constant and you can have any function run when that path is fetched.

The provided file has some example functions imported from another file.

@PeterHindes
PeterHindes / README.md
Last active January 28, 2024 20:45
Cloudflare Workers JWT Functions

Avalible Functions

generateKeyPair

Generates a public and private key

keyToString

Converts a key object into a string

stringToPrivateKey

converts a private key back from a string

stringToPublicKey

same but for public keys

sign

@PeterHindes
PeterHindes / fixit.sh
Created May 21, 2022 16:23
How to fix docker volumes permission denied on fedora and other selinux distros
setenforce 0
@PeterHindes
PeterHindes / docker-compose.yaml
Created May 21, 2022 06:10
Docker Compose With Haproxy
version : '3'
services:
ha:
image: haproxy
ports:
- "8080:8080"
- "8081:8081"
volumes:
- ./haproxy:/usr/local/etc/haproxy
@PeterHindes
PeterHindes / index.js
Last active May 25, 2022 22:28
Nodejs websockets boilerplate
const async = require('async')
,fs = require('fs')
,http = require('http')
,ws = require('websocket')
;
const APPID = process.env.APPID;
let connections = [];
const WebSocketServer = ws.server
@PeterHindes
PeterHindes / handle_ctrl_c_example.py
Last active February 15, 2022 18:23
Handle a user wanting to quit a looping terminal program.
import signal
import sys
import time
def signal_handler(signal, frame):
print("Wasting your time...")
time.sleep(3)
print("Goodbye")
raise SystemExit
signal.signal(signal.SIGINT, signal_handler)
@PeterHindes
PeterHindes / Consumer.sol
Created February 13, 2022 18:23
Solidity array of strings in another contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
contract SVG1 {
string[] public svg;
}
contract User is SVG1 {
SVG1 s;
constructor (address _provider) {