Skip to content

Instantly share code, notes, and snippets.

View sunng87's full-sized avatar
👑
keep calm and git push -f

Ning Sun sunng87

👑
keep calm and git push -f
View GitHub Profile
#!/usr/bin/env bash
#!/usr/bin/env bash
# Fetch contributors
contributors=$(gh api -X GET repos/$1/$2/contributors --jq '.[].login' | tr '\n' '|' | sed 's/|$//')
echo $contributors
# Export the CONTRIBUTORS environment variable
export CONTRIBUTORS="$contributors"
abort-on-warn = false
accept-flake-config = false
access-tokens =
allow-dirty = true
allow-import-from-derivation = true
allow-new-privileges = false
allow-symlinked-store = false
allow-unsafe-native-code-during-evaluation = false
allowed-impure-host-deps =
allowed-uris =

openpgp4fpr:ED91D234CAE973679AD46EA62E27E20FC4DEEA3E

@sunng87
sunng87 / rdp.py
Last active December 29, 2023 08:55
Greptimedb script for Ramer–Douglas–Peucker algorithm
import math
@coprocessor(
returns=["lon", "lat"],
)
def simplify(**params) -> (vector[f64], vector[f64]):
from greptime import query
results = query().sql(params["sql"])
lon = results[0]
@sunng87
sunng87 / Jetty11.java
Last active September 3, 2023 18:30
Dead simple setup of Jetty servers
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.eclipse.jetty:jetty-server:11.0.15
//DEPS org.eclipse.jetty:jetty-servlet:11.0.15
import static java.lang.System.*;
import java.io.IOException;
import org.eclipse.jetty.server.Server;
@sunng87
sunng87 / leancustomerdevelopment.org
Created May 23, 2022 09:58
Notes on Lean Customer Development
@sunng87
sunng87 / init.el
Created April 30, 2022 13:04
My emacs configuration
(require 'package)
;; (dolist (source '(("marmalade" . "http://marmalade-repo.org/packages/")
;; ("elpa" . "http://tromey.com/elpa/")
;; ("melpa" . "http://melpa.milkbox.net/packages/")
;; ("org" . "http://orgmode.org/elpa/")))
;; (add-to-list 'package-archives source t))
;;
;; ("marmalade" . "http://elpa.emacs-china.org/marmalade/")
;; ("org" . "http://elpa.emacs-china.org/org/")
;; ("elpa" . "http://elpa.emacs-china.org/gnu/")
@sunng87
sunng87 / gist:d4c06119224cd9ee4a927fccbb591af0
Created May 13, 2020 08:14
regex for matching json key/value
"(tomcat|jetty)":\s*"((\\"|[^"])*)",?
[global]
### Display ###
# Which monitor should the notifications be displayed on.
monitor = 0
# Display notification on focused monitor. Possible modes are:
# mouse: follow mouse pointer
# keyboard: follow window with keyboard focus
# none: don't follow anything
(defn camelcase-to-delimitered [k delimeter]
(->> (clojure.string/split k #"(?=[A-Z])")
(map clojure.string/lower-case)
(clojure.string/join delimeter)))
(defn camelcase-to-delimitered-keys [m delimiter]
(let [trans (fn [[k v]]
(let [[strfn keyfn] (if (keyword? k)
[name keyword]
[identity identity])