Skip to content

Instantly share code, notes, and snippets.

View exiguus's full-sized avatar
🍍

Simon Gattner exiguus

🍍
View GitHub Profile
@exiguus
exiguus / colors.ts
Created December 28, 2021 23:31
Generate HSL or RGB colors
export function getRandomInt(min: number, max: number): number {
min = Math.ceil(min)
max = Math.floor(max)
return Math.floor(Math.random() * (max - min) + min)
}
const getRandomRGBColors = (count = 16) => {
const colors: [number, number, number][] = []
const ranges = [255, 192, 128, 64, 32]
for (let i = 0; i < ranges.length; ) {
@exiguus
exiguus / currying.js
Last active February 23, 2021 10:44
Partial application and Currying in JavaScript
// JavaScript
//
// Partial application
// prefilling argument
const add = (...args) => [...args].reduce((a, b) => a + b)
const addMore = add.bind(undefined, 3, 5, 10)
console.log('bind addMore(2)', addMore(2)) // bind addMore(2) 20
const mergeObject = (a, b) => Object.freeze({
@exiguus
exiguus / useNetwork.ts
Created October 25, 2020 09:59
NetworkInfo Hook
import { useState, useEffect } from 'react'
// Network Information API
// NetworkInfo https://wicg.github.io/netinfo/
// https://caniuse.com/netinfo
enum ConnectionType {
'bluetooth',
'cellular',
'ethernet',
@exiguus
exiguus / docker-swarm-wikijs-postgres.md
Created August 3, 2020 07:33
Docker Swarm with wiki.js and PgBouncer
@exiguus
exiguus / 00-setup.md
Last active July 16, 2020 19:15
Proxmox Setup Host (bridge) intern/public (nat pfsense/non-host route)

Proxmox bridged Setup

Bridge Setup with additional (virtual) Guest IPs

  1. Proxmox host Debian
  • HOST proxmox
  • IP 1.0.0.23/24
  • Gateway IP 1.0.0.1
  1. Proxmox Guest pfSense (public)
  • HOST pfsense-public
@exiguus
exiguus / Multiplex.md
Created June 11, 2020 12:39
SSH Multiplexing

SSH Multiplexing

In OpenSSH, multiplexing can re-use an existing outgoing TCP connection for multiple concurrent SSH sessions to a remote SSH server, avoiding the overhead of creating a new TCP connection and reauthenticating each time. (https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Multiplexing)

  • sshuttle
  • ssh

sshuttle

@exiguus
exiguus / Readme.md
Created June 9, 2020 13:52
WP Docker Quick Setup

WP Docker Quick Setup

Docker Images WP / MySQL Dev Env

Run

Run docker-compose -f stack.yml up

Develop

@exiguus
exiguus / proxy.js
Created March 12, 2020 06:52
express / proxy, middleware - manipulate and map target requests and responses
/**
* express / proxy, middleware
* manipulate and map target requests and responses
*
* - inject assets to test / develop features, fixes ...
* - overwrite JavaScript and CSS served by the target
*/
/**
* Module dependencies.
@exiguus
exiguus / nginx.conf
Created October 25, 2019 19:29
nginx webdav config
server {
listen 127.0.0.1:8181;
server_name localhost;
root /var/www/webdav;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htaccess;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
@exiguus
exiguus / .htaccess
Created April 23, 2019 16:52
Light House Recommendations for Apache2
# .htaccess
# Apache/2.4.10 (Debian)
#
# AllowOverride FileInfo Indexes Options
##############################################
# Caching
##############################################
<IfModule headers_module>