Skip to content

Instantly share code, notes, and snippets.

Tienson Qin tiensonqin

Block or report user

Report or block tiensonqin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Consensus_Demo.thy
theory
Consensus_Demo
imports
Network
begin
datatype 'val msg
= Propose 'val
| Accept 'val
@tiensonqin
tiensonqin / observer.md
Created Jan 30, 2019 — forked from pnc/observer.md
Using Erlang observer/appmon remotely
View observer.md

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
View setup.sh
sysctl -w fs.file-max=12000500
sysctl -w fs.nr_open=20000500
ulimit -n 4000000
sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000'
sysctl -w net.ipv4.tcp_rmem='1024 4096 16384'
sysctl -w net.ipv4.tcp_wmem='1024 4096 16384'
sysctl -w net.core.rmem_max=16384
sysctl -w net.core.wmem_max=16384
wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
@tiensonqin
tiensonqin / transducers.ml
Created Jan 25, 2019
transducers in OCaml
View transducers.ml
type 'a sequence =
Nil
| Cons of 'a * (unit -> 'a sequence)
type 'a reduced = Continue of 'a | Done of 'a
(* TODO: some transforms have no needs to be reduced, for example map and filter, GADT may help here *)
type ('acc, 'a) reducef = 'acc reduced -> 'a -> 'acc reduced
(** A reduce function (or reducer). *)
View clojure-mode.el
;;; clojure-mode.el --- Major mode for Clojure code -*- lexical-binding: t; -*-
;; Copyright © 2007-2018 Jeffrey Chu, Lennart Staflin, Phil Hagelberg
;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba
;;
;; Authors: Jeffrey Chu <jochu0@gmail.com>
;; Lennart Staflin <lenst@lysator.liu.se>
;; Phil Hagelberg <technomancy@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
;; Artur Malabarba <bruce.connor.am@gmail.com>
@tiensonqin
tiensonqin / cljs-duplicate-parameter.cljs
Last active Jul 31, 2018
Parse error. Duplicate parameter name "body_format"
View cljs-duplicate-parameter.cljs
(ns cljs-duplicate-parameter.core)
(defn reproduce [{:keys [body_format]}]
(let [body-format body_format]
(fn []
(prn body-format))))
(reproduce {:body_format :asciidoc})
(defn ^:export init []
@tiensonqin
tiensonqin / specs.clj
Created Mar 23, 2018 — forked from roman01la/specs.clj
Figma File API specs
View specs.clj
(ns figma.specs
(:require [clojure.spec.alpha :as s]))
(def color-chan
(s/and number? #(<= 0 % 1)))
(def alpha-chan
(s/and number? #(<= 0 % 1)))
;;=============================================
@tiensonqin
tiensonqin / specs.clj
Created Mar 23, 2018 — forked from roman01la/specs.clj
Figma File API specs
View specs.clj
(ns figma.specs
(:require [clojure.spec.alpha :as s]))
(def color-chan
(s/and number? #(<= 0 % 1)))
(def alpha-chan
(s/and number? #(<= 0 % 1)))
;;=============================================
View index.js
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _affix = require('./affix');
Object.defineProperty(exports, 'Affix', {
enumerable: true,
You can’t perform that action at this time.