Skip to content

Instantly share code, notes, and snippets.

View sawthinkar's full-sized avatar
🌏
NetworkState > NationState > CityState

Saw Thinkar Nay Htoo sawthinkar

🌏
NetworkState > NationState > CityState
View GitHub Profile
// extract from TELENOR https://ecaf.telenor.com.mm/?orcf=1&lang=my
const townships = [
[
"AhGaYa",
"BaMaNa",
"DaHpaYa",
"HaPaNa",
"HpaKaNa",
"KaMaNa",
@dylanmckay
dylanmckay / facebook-contact-info-summary.rb
Last active November 14, 2024 18:04
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
@Aetherus
Aetherus / scale-out-phoenix-with-websocket.md
Last active February 23, 2024 14:31
How to scale out a Phoenix application with websocket

How to scale out a Phoenix application with websocket

Foreword

It's relatively easy to scale out stateless web applications. You often only need a reverse proxy. But for those stateful web applications, especially those applications that embeds websocket services in them, it's always a pain to distribute them in a cluster. The traditional way is introducing some external services like Redis to handle pubsub, however, in such way, you often need to change your code. Can Erlang/Elixir, the "concurrency oriented programming languages", best other languages in this use case? Has Phoenix framework already integrated the solution of horizontally scaling websocket? I'll do an experiment to prove (or disprove) that.

Resources

@Lakret
Lakret / gale_shapley.ex
Last active March 1, 2020 18:11
Gale-Shapley stable matching algorithm implementation in Elixir
defmodule StableMatching.Preference do
@enforce_keys [:id, :prefers]
defstruct id: nil, prefers: []
end
defmodule StableMatching.GaleShapley do
alias StableMatching.Preference
@doc """
Solves [stable matching problem](https://en.wikipedia.org/wiki/Stable_marriage_problem#Algorithm)
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active November 16, 2024 22:55
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@bmitch
bmitch / elixir.md
Last active August 31, 2019 05:14
elixir.md
@houtianze
houtianze / on.y.combinator.md
Last active August 2, 2024 07:07
On Y Combinator

Hopefully this may speed your groking of the forking torturing Y Combinator a little bit.

Disclaimer: I don't assert what I say here is accurate, or even correct (I'm not authorative, obviously), but it's my understanding and I'm sharing in the hope that someone who also struggles on the Y Combinator may benefit a tad.

Prerequisite Understandings

  • In Lambda Caculus, everything is a Lambda Caculus (Anonymous function that takes one parameter). And the best thing is that, ... drump roll ..., it's Turing Complete. So theoretically, it can caculate anything a computer can.
  • In this note, I use the term function, which (I think) means Lambda Caculus, to sound (at least to myself) more accustomed.

The definition of Y Combinator

  • Y = λf.(λx.f (x x)) (λx.f (x x))
@alphamu
alphamu / Android Privacy Policy Template
Created February 9, 2017 03:17
A template for creating your own privacy policy for Android apps. Look for "[" and "<!--" to see where you need to edit this app in order to create your own privacy olicy.
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
@dylankbuckley
dylankbuckley / LearnSwiftPartOne.playground
Created September 18, 2016 19:05
Learn Swift 3.0 & Xcode 8 (Part 1 - Swift Basics)
// Basic Operators
35 + 98
62 - 14
50 / 10
463 * 173
// Types
var age: Int = 21 // Int = Integer = Any whole number
var milesCanRun: Double = 0.75 // Double = Float = Decimal Number
@spenserhuang
spenserhuang / elixir-resources.md
Last active April 8, 2018 17:36
List of Elixir Resources