Skip to content

Instantly share code, notes, and snippets.

View jeongho's full-sized avatar

Jeongho Park jeongho

  • Deception Island, Antarctica
View GitHub Profile
@jeongho
jeongho / postgres-scalable-sequence.sql
Created January 22, 2021 02:00
postgres-scalable-sequence.sql
--# postgresql 12 high availability cookbook ch14: creating a scalable nextval replacement
--## this example has 2048 shards (schemas) and 2048 unique values per millisecond (seq % 2048)
--# ref: [Sharding & IDs at Instagram](https://instagram-engineering.com/sharding-ids-at-instagram-1cf5a71e5a5c)
CREATE SCHEMA shard;
CREATE SEQUENCE shard.table_id_seq;
CREATE OR REPLACE FUNCTION shard.next_unique_id(
shard_id INT
)
@jeongho
jeongho / haproxy_ssl_termination_springboot_backend.cfg
Last active October 27, 2021 10:12
HAProxy SSL Termination CORS
# haproxy -v
# HA-Proxy version 2.3.14-83c5b44 2021/09/07 - https://haproxy.org/
# Status: stable branch - will stop receiving fixes around Q1 2022.
# Known bugs: http://www.haproxy.org/bugs/bugs-2.3.14.html
# Self-signed SSL certificate
# https://gridscale.io/en/community/tutorials/haproxy-ssl/
# openssl req -nodes -x509 -newkey rsa:2048 -keyout /etc/ssl/private/test.key -out /etc/ssl/private/test.crt -days 3650
# writing new private key to '/etc/ssl/private/test.key'
# -----