Skip to content

Instantly share code, notes, and snippets.

View bit-app-3000's full-sized avatar
πŸ’­
πŸ‰ Hot Tequila Brown

bit-app-3000

πŸ’­
πŸ‰ Hot Tequila Brown
View GitHub Profile
@bit-app-3000
bit-app-3000 / simple-hash.js
Created December 11, 2024 13:16 — forked from jlevy/simple-hash.js
Fast and simple insecure string hash for JavaScript
// These hashes are for algorithmic use cases, such as bucketing in hashtables, where security isn't
// needed and 32 or 64 bits is enough (that is, rare collisions are acceptable). These are way simpler
// than sha1 (and all its deps) or similar, and with a short, clean (base 36 alphanumeric) result.
// A simple, *insecure* 32-bit hash that's short, fast, and has no dependencies.
// Output is always 7 characters.
// Loosely based on the Java version; see
// https://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript
const simpleHash = str => {
let hash = 0;
@bit-app-3000
bit-app-3000 / nginx.conf
Created December 8, 2023 17:48 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@bit-app-3000
bit-app-3000 / docker-compose.yml
Created November 19, 2023 09:01 — forked from tateg/docker-compose.yml
Shared Postgres socket for Docker Compose
version: '3.5'
services:
postgres:
container_name: postgres
image: postgres:14-bullseye
environment:
POSTGRES_PASSWORD: password
volumes:
- "./postgres/socket:/var/run/postgresql"
app:
@bit-app-3000
bit-app-3000 / serve.js
Created May 21, 2023 12:16 — forked from martinrue/serve.js
Using esbuild's serve function for an SPA, equivalent to webpack's `devServer.historyApiFallback`.
const http = require("http");
const esbuild = require("esbuild");
const serve = async (servedir, listen) => {
// Start esbuild's local web server. Random port will be chosen by esbuild.
const { host, port } = await esbuild.serve({ servedir }, {});
// Create a second (proxy) server that will forward requests to esbuild.
const proxy = http.createServer((req, res) => {
// forwardRequest forwards an http request through to esbuid.
@bit-app-3000
bit-app-3000 / README.md
Created May 1, 2023 12:53 — forked from jose-mdz/README.md
Orthogonal Diagram Connector

Orthogonal Connectors

This algorithm returns the points that form an orthogonal path between two rectangles.

How to Use

// Define shapes
const shapeA = {left: 50,  top: 50, width: 100, height: 100};
const shapeB = {left: 200, top: 200, width: 50, height: 100};
@bit-app-3000
bit-app-3000 / grpc+avro.js
Created April 21, 2023 11:07 — forked from brandonros/grpc+avro.js
gRPC + SSL with Avro encoding in node.js
const grpc = require('grpc')
const fs = require('fs')
const avro = require('avsc')
const hexdump = require('hexdump-nodejs')
const encodeMessage = (avroType, request) => {
let opts = {
codec: null,
writeHeader: true
}
@bit-app-3000
bit-app-3000 / starUML.md
Created December 10, 2022 12:00 — forked from trandaison/starUML.md
Get full version of StarUML
@bit-app-3000
bit-app-3000 / docker-compose.yml
Created July 14, 2022 19:53 — forked from onjin/docker-compose.yml
example docker compose for postgresql with db init script
postgres:
image: postgres:9.4
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
@bit-app-3000
bit-app-3000 / 2019-https-localhost.md
Created January 22, 2021 11:09 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).