Skip to content

Instantly share code, notes, and snippets.

@tiensonqin
tiensonqin / config.edn
Created July 23, 2020 00:46
Logseq config.edn template
{:project {
;; Selected public notes can be published to https://logseq.com/your-project-or-your-username.
:name ""
:alias ""
;; your twitter handle
:twitter ""
;; description supports both hiccup and html
:description []}
;; Git settings
@tiensonqin
tiensonqin / logseq.edn
Created June 28, 2020 23:30
A logseq.edn example
{:git-auto-push true
:git-push-secs 10
:git-pull-secs 60
:hidden ["/pem"]
:text-formats []
:image-formats []
:starred ["LATER"
theory
Consensus_Demo
imports
Network
begin
datatype 'val msg
= Propose 'val
| Accept 'val
@tiensonqin
tiensonqin / Connect to Google Home
Created August 2, 2019 08:52 — forked from willwhui/Connect to Google Home
Connect to Google Home
Connect to Google Home
@tiensonqin
tiensonqin / observer.md
Created January 30, 2019 14:53 — forked from pnc/observer.md
Using Erlang observer/appmon remotely

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
@tiensonqin
tiensonqin / setup.sh
Created January 30, 2019 14:50 — forked from Gazler/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 January 25, 2019 09:06
transducers in OCaml
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). *)
;;; 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 July 31, 2018 09:01
Parse error. Duplicate parameter name "body_format"
(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 March 23, 2018 11:54 — forked from roman01la/specs.clj
Figma File API specs
(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)))
;;=============================================