Skip to content

Instantly share code, notes, and snippets.

View kotharthar's full-sized avatar

Thar Htet kotharthar

View GitHub Profile
@kotharthar
kotharthar / arch-justfile
Last active May 7, 2023 13:03
JUST file with recipes to setup, initialize and generate C4 Model (software architecture) files to PNG files.
# Install JUST from https://just.systems
# Put this `arch-justfile` into target folder and rename it to `justfile`
# Then Run `just -l` to see the full list of Recipes.
# Install necessary toolings
setup:
#!/usr/bin/env sh
# Check if Brew is available otherwise install it
if ! command -v brew &> /dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)";
@kotharthar
kotharthar / MaePaySohAPIVersion1.json.postman_collection
Created August 21, 2015 09:32
MaePaySohAPI-PostmanCollection-Version1
{
"id": "a98ee9d2-12e1-e302-1c0d-da0a7403e746",
"name": "Mae Pay Soh API",
"description": "",
"order": [
"874eaf47-dfbb-7492-4049-b570a7cfe6dc"
],
"folders": [
{
"id": "59743053-8e46-535f-f3f6-2ea3df28e004",
# Simple bijective function
# Basically encodes any integer into a base(n) string,
# where n is ALPHABET.length.
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047
ALPHABET =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//)
# make your own alphabet using:
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join

hello_world.web

Node

var http = require('http');

var server = http.createServer(function (request, response) {
# simple HTTPServer:
# useful to test your pages/api calls!
class HTTPServer
def initialize(port, body)
require 'socket'
@server = Thread.new do
server = TCPServer.open port
loop do
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby