Skip to content

Instantly share code, notes, and snippets.

View oldmonad's full-sized avatar
Professional Learner

DC oldmonad

Professional Learner
  • Lagos.Nigeria
View GitHub Profile
@oldmonad
oldmonad / ShakaPlayerAppleFairPlayBuyDRM.html
Created May 21, 2025 20:32 — forked from nathanagez/ShakaPlayerAppleFairPlayBuyDRM.html
Shaka Player Apple Fairplay - BuyDRM implementation
<!DOCTYPE html>
<html>
<head>
<!-- Shaka Player compiled library: -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/4.3.3/shaka-player.compiled.debug.min.js"
integrity="sha512-wTnBx6lDjouPRTLQUxGz9Djs/+d5m2XsIbCyxZe7H2mVCImlKjx+PcuLisTDPQD5uSq+eNrdOtZtu08zrkHLMA=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>
<body>
@oldmonad
oldmonad / drizzle-ulid.md
Created May 9, 2025 13:44 — forked from MendyLanda/drizzle-ulid.md
Implementing Efficient Binary ULID Storage in MySQL with Drizzle ORM

For anyone considering the use of ULIDs in MySQL with drizzle, here's a ready-to-use ULID type for your convenience.

import { Ulid as ULID } from "id128";

export const ulid = customType<{
  data: string;
  notNull: true;
  default: false;
@oldmonad
oldmonad / gistlog.yml
Created May 7, 2025 18:45 — forked from askilondz/gistlog.yml
Adaptive Streaming with MPEG-DASH and HLS using AWS

Adaptive Streaming has become the neccessity for streaming video and audio. Unfortantely, as of this post, there isn't a whole lot of tutorials that accumulate all of the steps to get this working. Hopefully this post achieves that. This post focuses on using Amazon Web Services (AWS) to transcode for HLS and DASH and be the Content Delivery Network (CDN) that delivers the stream to your web page. We'll be using Video.js for the HTML5 player as well as javascript support libaries to make Video.js work with HLS and DASH.

So Here's what you need:

Set up three S3 buckets

@oldmonad
oldmonad / README.md
Created May 16, 2023 06:59 — forked from cohawk/README.md
CockroachDB fork of the postgrex adapter - Elixir Ecto caveats

Over the weekend I spun up a new Elixir :ecto, "2.2.7" project that I was able to get working with CockroachDB and this adapter fork - with some caveats I wanted to share to help others.

  1. Only the root user can create databases This requires you configure the Ecto.Adapters.Postgres username as root or else the mix ecto.create command will always fail. You can go back and change your configured username to something else after the database has been created, or create your database and user permissions using cockroach sql and skip the mix ecto.create command.

  2. Configuring Ecto primary_key ID to be created by CockroachDB By default when configuring your Ecto.Schema using autogenerate: false it appears either CockroachDB, Ecto or the Postrex adapter (I did not investigate this) uses the BIGINT unique_rowid() function as the default value for IDs

@primary_key {:id, :id, autogenerate:
@oldmonad
oldmonad / amazon.md
Created September 9, 2022 10:59 — forked from terabyte/amazon.md
Amazon's Build System

Prologue

I wrote this answer on stackexchange, here: https://stackoverflow.com/posts/12597919/

It was wrongly deleted for containing "proprietary information" years later. I think that's bullshit so I am posting it here. Come at me.

The Question

Amazon is a SOA system with 100s of services (or so says Amazon Chief Technology Officer Werner Vogels). How do they handle build and release?

/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import { Model, Page, QueryBuilder } from 'objection';
type Options = {
columnName?: string;
@oldmonad
oldmonad / promisified-grpc-client.ts
Created July 17, 2022 19:00 — forked from smnbbrv/promisified-grpc-client.ts
Promisify @grpc-js service client with typescript
import { Client, ServiceError, Metadata, CallOptions, ClientUnaryCall } from '@grpc/grpc-js';
import { Message } from 'google-protobuf';
type OriginalCall<T, U> = (request: T, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError, res: U) => void) => ClientUnaryCall;
type PromisifiedCall<T, U> = ((request: T, metadata?: Metadata, options?: Partial<CallOptions>) => Promise<U>);
export type Promisified<C> = { $: C; } & {
[prop in Exclude<keyof C, keyof Client>]: (C[prop] extends OriginalCall<infer T, infer U> ? PromisifiedCall<T, U> : never);
}
@oldmonad
oldmonad / array_iteration_thoughts.md
Created June 27, 2022 06:42 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

@oldmonad
oldmonad / package-lock-conflicts.md
Created June 16, 2022 21:34 — forked from szemate/package-lock-conflicts.md
How to resolve package-lock.json conflicts

How to resolve package-lock.json conflicts

It is not possible to resolve conflicts of package-lock.json in GitHub's merge tool and you need to do a manual merge.

  1. Update the main branch with the latest changes:
    git checkout main
    git pull
    
  2. Merge your feature branch into main:

A description of known problems in Satoshi Nakamoto's paper, "Bitcoin: A Peer-to-Peer Electronic Cash System", as well as notes on terminology changes and how Bitcoin's implementation differs from that described in the paper.

Abstract

The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power.