Skip to content

Instantly share code, notes, and snippets.

View cyang-el's full-sized avatar
💭
I may be slow to respond.

C.H. Yang cyang-el

💭
I may be slow to respond.
View GitHub Profile
SPECIFICATION Spec
CONSTANTS
C = {c1, c2, c3}
Srv = {s1}
DB = {d1}
MaxID = 10
SrvCap = 1
ProcTime = 4
ReqRate = 1
---- MODULE break ----
EXTENDS Integers, Sequences, TLC, FiniteSets
Max(S) == CHOOSE x \in S : \A y \in S : x >= y
CONSTANTS
C,
Srv,
DB,
MaxID,
@cyang-el
cyang-el / 3_tier_1.tla
Last active March 21, 2025 19:29
simple 3 tier web app in TLA+
---- MODULE 3_tier_1 ----
EXTENDS Integers, Sequences, TLC, FiniteSets
CONSTANTS Clients, Srvrs, DBs, MaxID
VARIABLES
clReqs, \* Client requests
clResps, \* Client responses
srvQueue, \* Server queue
srvProc, \* Server processing
dbQ, \* Database queries
dbDat, \* Database data
@cyang-el
cyang-el / space.rb
Last active December 12, 2024 21:01
a from scrach space invader game in terminal with Ruby https://asciinema.org/a/694571
require 'io/console'
# RC
module RC
# IOLoop
class IOLoop
def initialize(io, game)
@io = io
@handle_game = game.method(:handle)
@update_game = game.method(:update)
@cyang-el
cyang-el / 2048.rb
Last active December 3, 2024 13:15
a from scrach terminal 2048 game in Ruby :) asciinema: https://asciinema.org/a/693144
# frozen_string_literal: true
require 'io/console'
SIZE = 5
def run
$stdin.echo = false
board = init_board
render!(board)
@cyang-el
cyang-el / cpp-dev-env-flake.nix
Created February 18, 2024 23:05 — forked from fufexan/cpp-dev-env-flake.nix
C/C++ dev environment in Nix, using Clang
{
description = "C/C++ environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils, ... }@inputs:
utils.lib.eachDefaultSystem (
@cyang-el
cyang-el / web-servers.md
Created November 16, 2020 16:14 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@cyang-el
cyang-el / nixos.md
Created October 25, 2020 12:39 — forked from martijnvermaat/nixos.md
Installation of NixOS with encrypted root

Keybase proof

I hereby claim:

  • I am cyang-el on github.
  • I am cyang_el (https://keybase.io/cyang_el) on keybase.
  • I have a public key ASDVZ3dFXrnNxObMa4iDo8hV48KmSYU4Y7UO_e0tDHmy9Ao

To claim this, I am signing this object:

@cyang-el
cyang-el / Makefile
Created August 30, 2019 14:44 — forked from cooldaemon/Makefile
libxml2 sax sample.
xml2_sax_sample: xml2_sax_sample.c
gcc -o xml2_sax_sample `xml2-config --cflags --libs` xml2_sax_sample.c
clean:
rm xml2_sax_sample