Skip to content

Instantly share code, notes, and snippets.

View jdh8's full-sized avatar
🦦
Tsuí-thuah tsiok kóo-tsui

Chen-Pang He jdh8

🦦
Tsuí-thuah tsiok kóo-tsui
View GitHub Profile
@jdh8
jdh8 / benchmark-rounding.cpp
Created September 2, 2025 17:37
Benchmark the default rounding
// Copyright (c) 2025 Chen-Pang He <chen.pang.he@jdh8.org>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
@jdh8
jdh8 / gist:cda87471677e6412d442a09ba874f479
Created October 21, 2024 16:28
內湖少年無照駕駛撞死三人的悲劇 by James Hsieh, 2024
James Hsieh:
以下這篇文章我在1019晚上寫好,內容是內湖少年無照駕駛撞死三人的悲劇
不到20小時累積近九千讚三千分享十幾萬人觸及,結果1020被不明大軍連續惡意檢舉下架文章,臉書審查後說恢復上架,但文章卻無法恢復永遠消失,更誇張是我後續任何相關發文,還是被神秘大軍不斷無腦檢舉到下架
要玩就玩大一點,我要對抗這黑暗勢力
請幫我做以下三件事情
1.點讚
2.分享
3.下面文章授權給每個人使用,歡迎複製貼上重發到你的臉書/IG/THREADS,這篇文我已把關鍵字眼都修飾過,當每個人都發了這篇文,我看你要怎樣檢舉,大海無量
我想看看這個無照駕駛撞死三人事件的背後黑暗勢力有多大
你不僅能請統媒寫噁爛洗風向文章,還能買多少公關公司或請臉書暗鬼下架對你不利的東西?
@jdh8
jdh8 / erfinv.jl
Created November 3, 2020 15:20
Polyfill SpecialFunctions.erfinv(::BigFloat)
using SpecialFunctions
function SpecialFunctions.erfinv(x::BigFloat)
c = √big(π) / 2
y::BigFloat = erfinv(Float64(x))
y += c * exp(y * y) * (x - erf(y))
y += c * exp(y * y) * (x - erf(y))
y += c * exp(y * y) * (x - erf(y))
return y
end
@jdh8
jdh8 / inference.py
Created July 8, 2019 10:10
ONNX operator inference by immediately constructed single-layer model
import numpy
import onnx
import onnxruntime
def infer(operator, *inputs, outputs=1, **attributes):
tags = {
numpy.void: onnx.TensorProto.UNDEFINED,
numpy.float32: onnx.TensorProto.FLOAT,
numpy.uint8: onnx.TensorProto.UINT8,
numpy.int8: onnx.TensorProto.INT8,
#include "FILE.h"
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
static uint_least32_t _modifier(unsigned c)
{
unsigned s = c - ' ';
return s < 32 ? UINT32_C(1) << s : UINT32_C(0);
@jdh8
jdh8 / f100.c
Last active March 14, 2019 02:53
Fibonacci sequence from F(0) to F(100)
#include <stdio.h>
static void print128(unsigned __int128 a)
{
const unsigned long long base = 10000000000000000000;
if (a >> 64)
printf("%llu%0.19llu\n", (unsigned long long)(a / base), (unsigned long long)(a % base));
else
printf("%llu\n", (unsigned long long)a);
@jdh8
jdh8 / chudovsky.cpp
Created January 15, 2018 15:59
Compute 2/pi
#include <gmpxx.h>
#include <limits>
#include <iostream>
#include <iomanip>
static mpq_class _rational(mp_bitcnt_t iterations)
{
mpz_class K = 6;
mpz_class M = 1;
mpz_class L = 13591409;
@jdh8
jdh8 / chebyshev.cpp
Created October 13, 2017 15:37
Chebyshev interpolation on erfc
#include <array>
#include <cmath>
#include <iostream>
#include <ccomplex>
#include <fftw3.h>
namespace {
template<typename>
class Plan;
@jdh8
jdh8 / 8char.js
Last active July 31, 2017 18:52
八字命學
function 八字命學(stdlib)
{
"use asm";
function main()
{
}
return main;
}
@jdh8
jdh8 / default.diff
Created February 26, 2017 17:45
Translate default.liquid from English to Chinese. -- https://github.com/jdh8/sweet-16/blob/master/_layouts/default.liquid
diff --git a/_layouts/default.liquid b/_layouts/default.liquid
index 2aab8d0..998ad36 100644
--- a/_layouts/default.liquid
+++ b/_layouts/default.liquid
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html lang="en">
+<html lang="zh-Hant">
<head>
<meta charset="UTF-8">