Skip to content

Instantly share code, notes, and snippets.

Andy Kellerstrass zero5100

Block or report user

Report or block zero5100

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zero5100
zero5100 / create-docker-tls.sh
Created Mar 1, 2018 — forked from mac2000/create-docker-tls.sh
Creating and setting up Docker for TLS
View create-docker-tls.sh
#!/bin/bash
# At the end you will have 6 files:
# ca/ca.pem - used by both client and server to verify each other certificates
# ca/ca-key.pem - keep it in secret it may be used to generate new certificates
# client/cert.pem, client/key.pem - in conjunction with /ca/ca.pem will be used by client to speak with server
# server/cert.pem, server/key.pem - in conjunction with /ca/ca.pem will be used by server
#
# NOTICE: DO NOT FORGET to set your **Server** ip and dns in server/openssl.cnf each time you generating new server certificates
#
@zero5100
zero5100 / apportion_lrm.sql
Last active Oct 12, 2017
This is an apportionment function using the Largest Remainder Method (LRM) used to divide a given total amount between any number of buckets proportionally.
View apportion_lrm.sql
DROP FUNCTION IF EXISTS apportion_lrm(NUMERIC, JSONB, INTEGER, NUMERIC, BOOLEAN);
CREATE FUNCTION apportion_lrm
(
IN apportion_amt NUMERIC,
IN proportions JSONB,
IN data_scale INTEGER DEFAULT 0,
IN proportion_total NUMERIC DEFAULT NULL,
IN allow_truncate_apportion BOOLEAN DEFAULT FALSE
)
RETURNS JSONB AS $BODY$
View postgres date time zone difference
// Test when ran using the postgresql connector
// Create a new instance of the model
loopback:connector:postgresql SQL: INSERT INTO "public"."phone_cdr"("caller_name","caller_number","phone_number_dialed","call_start_date_gmt","call_status") VALUES($1,$2,$3,to_timestamp($4,'yyyy-mm-dd hh24:mi:ss.ms'),$5) RETURNING "id"
Parameters: ["test","1234567","7654321","2015-01-01T00:00:00.000Z","A"] +465ms
loopback:connector:postgresql {
"command": "INSERT",
"rowCount": 1,
"oid": 0,
"rows": [{
@zero5100
zero5100 / gist:5154782
Created Mar 13, 2013
How to limit the network speed
View gist:5154782
Installing:
sudo apt-get install wondershaper
Use:
(Speeds are in KB)
sudo wondershaper eth0 downspeed upspeed
e.g. sudo wondershaper eth0 500 500
Restoring normal speed:
You can’t perform that action at this time.