Skip to content

Instantly share code, notes, and snippets.

View pangkalizer's full-sized avatar

Allan Andal pangkalizer

  • Sydney, Australia
View GitHub Profile
⏺ Capacity Pricing Model — How It Works
Core idea
A tenant pays a fixed monthly fee determined upfront by their expected usage profile (how many hosts, how big the audience, how long streams run, how often). It's prepaid — charged at the start of each billing period,
not at the end.
---
The four inputs (sliders)

Project Keystone – Hosting Plan

This document outlines how to host the Keystone live-streaming system in development, staging, and production.


1. System components (recap)

Component Role Ports / protocol Depends on
@pangkalizer
pangkalizer / typescript-crash.ts
Created June 6, 2025 07:19 — forked from bradtraversy/typescript-crash.ts
Basic intro to TypeScript (From YouTube Crash Course)
// Basic Types
let id: number = 5
let company: string = 'Traversy Media'
let isPublished: boolean = true
let x: any = 'Hello'
let ids: number[] = [1, 2, 3, 4, 5]
let arr: any[] = [1, true, 'Hello']
// Tuple
@pangkalizer
pangkalizer / Terraform on Mac M1.md
Created September 26, 2023 01:59 — forked from straubt1/Terraform on Mac M1.md
Notes to install Terraform on M1

Installing the amd64 version of Terraform on Mac with M1

Not all Terraform providers are built for arm64.

One solution here is to install Terraform as amd64 which can be easily done from the downloads page.

However, for those who are using and switching between versions of Terraform often, a more streamlined approach is desirable.

Enter asdf.

alias deploydiff="git log production..master --pretty=format:'%<(25)%an %s' --abbrev-commit"
@pangkalizer
pangkalizer / sidekiq.rb
Created October 27, 2017 00:50 — forked from stevenharman/sidekiq.rb
The best solution I've found for reliably configuring Sidekiq's ActiveRecord connection pool size on Heroku.
# /config/initializers/sidekiq.rb
current_web_concurrency = Proc.new do
web_concurrency = ENV['WEB_CONCURRENCY']
web_concurrency ||= Puma.respond_to?
(:cli_config) && Puma.cli_config.options.fetch(:max_threads)
web_concurrency || 16
end
local_redis_url = Proc.new do
desc 'Generates jmeter test plan'
task :generate_jmeter_plan, [:url, :email, :password, :count] do |t, args|
require 'ruby-jmeter'
generate_report *extract_options_from(args)
end
def extract_options_from(args)
defaults = {
url: 'http://lvh.me:3000',
email: 'user@example.com',
@pangkalizer
pangkalizer / convert_all_tables_to_innodb.sql
Created May 19, 2016 07:22
convert MEMORY tables to InnoDB
DELIMITER $$
DROP DATABASE IF EXISTS `test` $$
CREATE DATABASE `test` $$
DROP PROCEDURE IF EXISTS `test`.`convert_all_tables_to_innodb` $$
CREATE PROCEDURE `test`.`convert_all_tables_to_innodb`()
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE alter_sql VARCHAR(5000);
DECLARE cur1 CURSOR FOR
SELECT CONCAT('ALTER TABLE ', TABLE_SCHEMA, '.', TABLE_NAME, ' ENGINE=innodb, ALGORITHM=copy;') as alter_sql
@pangkalizer
pangkalizer / gist:86f158f0b13520854e920a4a5be669b1
Created May 19, 2016 06:41
MySQL to Aurora migration (minimal downtime)
MySQL Database to Aurora Migration
Preparation Check-list
Update the production Security Group so that Inbound accepts connection from same VPC group as source (requires for replication).
On the production server, set bin log retention hours, this is duration in hours before binary logs are automatically deleted. This also acts a window time to copy and migrate the production server into a Aurora replica. Currently the production server is set to NULL which means AWS delete the logs as soon as it doesn't need it any more.
CALL mysql.rds_set_configuration('binlog retention hours', 48);
Convert all tables using MEMORY engine to InnoDB, AWS converts all tables to InnoDB during migration, however keeping MEMORY engine tables on production causes issues on replication.
@pangkalizer
pangkalizer / update_image
Created March 8, 2016 01:25
update docker image with squash
#!/bin/bash
# Syntax: update_image <CONTAINER_NAME> <IMAGE_REPO>
CONTAINER_NAME="$1"
IMAGE_REPO="$2"
if [ "$CONTAINER_NAME" = "" ]; then
echo "Error: Missing container name"; exit 1;
fi