Skip to content

Instantly share code, notes, and snippets.

View bentesha's full-sized avatar

Benedict Tesha bentesha

View GitHub Profile
function Robot(name, job) {
this.name = name;
this.job = job;
}
Robot.prototype.introduce = function() {
console.log("Hi! I'm " + this.name + ". My job is " + this.job + ".");
};
var bender = new Robot("Bender", "bending");
const introduce = function() {
console.log("Hi! I'm " + this.name + ". My job is " + this.job + ".");
}
function makeRobot(name, job) {
return {
name: name,
job: job,
introduce,
@bentesha
bentesha / haproxy-cheatsheet.cnf
Last active August 30, 2023 15:04
HA Proxy Cheatsheet
# Common fetches
# Match source IP address
acl is_malicious src 192.168.10.32
acl is_local_net src 192.168.32.0/24 # match IP range
# Match request path
acl is_api path -i -m beg /api # match paths starting with /api
acl is_image -i -m end .jpg .png .gif # match paths ending with .jpg .png and .gif extensions
acl is_health -i path_str /health # exact match path /health
@bentesha
bentesha / min-haproxy.conf
Last active August 1, 2019 23:27
Min HAProxy Config with ACL for Load Balancing Multiple Name Virtual Hosts
global
maxconn 25000
log /dev/log local0 info
# debug
# silent
user haproxy
group haproxy
daemon
defaults
@bentesha
bentesha / ipsec.conf
Last active July 5, 2020 17:16
StrongSwan IPSec configuration file starter
config main
interfaces=%default
nat-ikeport=4500 # Port to use for NAT-T. This is the default value
ikeport=500 # Port to use for IKE. This is the default value
# listen=<ip address> # The IP address on of the host to be used by IPSec
conn <conn-name> # Name of this connection
auto=start # Start this connection on IPSec startup
authby=secret # Use PSK to authenticate peers
type=tunnel
@bentesha
bentesha / ipsec-config-parameters
Last active July 5, 2020 18:24
Useful StrongSwan IPSec config parameters
# Connection parameters
# =====================
# Connection parameters general
keyexchange=ike # IKE version to use. Default to ike (IKE version 1). Use ikev2 for IKEv2
connaddrfamily=ipv4 # The default value
type=tunnel # Type of the connection. Possible values are
# tunnel - host-to-host, host-to-subnet, subnet-to-subnet tunnel
# transport - host-to-host transport mode
# passthrough - no IPSec processing should be done
# drop - Packets should be discared