Skip to content

Instantly share code, notes, and snippets.

View humorless's full-sized avatar

Laurence Chen humorless

View GitHub Profile
@humorless
humorless / assert-or-not.md
Created December 2, 2024 08:43 — forked from daveliepmann/assert-or-not.md
A guide to orthodox use of assertions in Clojure.

When to use assert?

In JVM Clojure, Exceptions are for operating errors ("something went wrong") and Assertions are for programmer and correctness errors ("this program is wrong").

An assert might be the right tool if throwing an Exception isn't enough. Use them when the assertion failing means

  • there's a bug in this program (not a caller)
  • what happens next is undefined
@humorless
humorless / sales_forecasting_monte.py
Last active November 2, 2024 10:47
The sales forecasting formula using Monte Carlo method
import numpy as np
import matplotlib.pyplot as plt
# 假設參數
lambda_visits = 5 # 主動拜訪次數的均值
lambda_leads = 3 # 主動找上門的客戶數均值
alpha = 0.1 # 主動拜訪轉換率
beta = 0.5 # 主動找上門轉換率
# 蒙地卡羅模擬
@humorless
humorless / prompt-business.md
Last active December 23, 2024 02:47
Good Prompt

推斷 niche market

從網路上現存的資訊,分析 {公司官方網站} 這家公司。

{公司名稱} 是什麼細分市場的領導者?

推斷 value proposition

@humorless
humorless / java-time.api.md
Created August 17, 2024 07:27
java time library

Duration

(time/duration dur-str)

ZoneId type

(def event-time-zone (java.time.ZoneId/of "Europe/Brussels"))
@humorless
humorless / emacs.md
Last active February 4, 2024 03:50
corgi 筆記
@humorless
humorless / practice.cql
Created August 30, 2023 10:46
My practice of Cypher
Find People Born in the Fifties
Using the sandbox on the right, write and execute a query to return people born in the 1950’s (1950 - 1959) that are both Actors and Directors.
How many Person nodes are returned?
```
MATCH(p:Actor)
WHERE p:Director AND date('1950-01-01') <= date(p.born) < date('1959-12-31')
RETURN count(p)
```
@humorless
humorless / postwalk-example.clj
Created August 29, 2023 17:02
Example to show postwalk
(ns myproject
"FIXME: my new org.corfield.new/scratch project."
(:require [clojure.walk :as walk]))
(def tree
(list #:cil{:id 2
:children
(list #:citl{:id 2 :ip 2
:children
(list #:citl{:id 5 :tp 2}
@humorless
humorless / result.clj
Created August 28, 2023 10:19
Demo of treewalk - prewalk
[:customer-invoice
[:div.bg-violet-100.m-2.p-2.flex
[:p.flex-auto "Reference-number: invoice 1"]
[:p.flex-auto "status: unreleased"]]
[:customer-invoice-line
[:div.bg-violet-100.m-2.p-2.flex
[:p.flex-auto "Id: 1"]
[:p.flex-auto "Invoice: invoice 1"]
[:p.flex-auto "Amount: 2000"]]
[:customer-invoice-tax-line
@humorless
humorless / tax-lines-to-hiccup.clj
Last active August 28, 2023 09:45
Demo of treewalk
(ns myproject
"FIXME: my new org.corfield.new/scratch project."
(:require [clojure.walk :as walk]))
(def lines
(list {:reference-number "invoice 1"
:status "unreleased"}
(list {:invoice "invoice 1"
:account "100"
:desp "customer invoice line"
@humorless
humorless / dbt-duckdb-tutorial.md
Last active May 18, 2024 15:43
Modern data stack by REPLWARE

Modern data stack

Main features

REPLWARE 建議的資料分析技術棧 (modern data stack) 主要有下列特色:

  • ELT over ETL
  • SQL based analytics over non-SQL based analytics
  • Analytic Engineer as a new position
  • When the data is not exceeding 1T, your desktop/notebook is fast enough.