Skip to content

Instantly share code, notes, and snippets.

View defclass's full-sized avatar
:octocat:
Working from home

Michael Wong defclass

:octocat:
Working from home
View GitHub Profile
(ns defclass.test-framework)
(def all-test (atom {}))
(def ^:dynamic *test* true)
(defmacro is [expr]
`(let [result# ~expr]
(when-not result#
(set! *test* false)
(printf "FAILED: %s%n" '~expr))))
@defclass
defclass / git-auto-push.sh
Last active February 16, 2024 02:45
auto push to Github when files change
#!/bin/bash
## Tested on macOS big sur 11.2.1
## Usage:
## git-auto ;; use current script dir as git dir, and auto commit, not push.
## git-auto -d /path/to/your/note's/dir ;; set git dir
## git-auto -p ;; auto commit and push
## git-auto -s origin -p ;; set remote server
## git-auto -b main -p ;; set git branch
## git-auto -i 30 -p ;; set interval seconds
@defclass
defclass / introrx.md
Created February 7, 2021 02:27 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@defclass
defclass / jd.md
Last active March 1, 2023 08:44
开源笔记 Logseq 远程团队招聘两位开发工程师 [已结束]

开源笔记 Logseq 远程团队招聘两位开发工程师 [已结束]

v2ex帖子地址

cnodejs帖子地址

工作时间,方式,内容与待遇

  • 全员远程,WFH,WLB。
@defclass
defclass / redsocks.rules
Created August 16, 2019 03:20
/etc/iptables/redsocks.rules
# Transparent SOCKS proxy
# See: http://darkk.net.ru/redsocks/
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:REDSOCKS - [0:0]
@defclass
defclass / ss-install.md
Created July 9, 2019 03:22 — forked from aa65535/ss-install.md
shadowsocks-libev install at Debian or CentOS

Debian

cd /tmp
# 编译环境准备&安装依赖包
apt-get install --no-install-recommends build-essential autoconf libtool libssl-dev libpcre3-dev asciidoc xmlto git
# 克隆源码
git clone --recursive https://github.com/shadowsocks/shadowsocks-libev.git
# 开始编译
@defclass
defclass / sha1-hash.clj
Created November 19, 2018 07:59 — forked from hozumi/sha1-hash.clj
clojure sha1 hash
(defn sha1-str [s]
(->> (-> "sha1"
java.security.MessageDigest/getInstance
(.digest (.getBytes s)))
(map #(.substring
(Integer/toString
(+ (bit-and % 0xff) 0x100) 16) 1))
(apply str)))
@defclass
defclass / install.sh
Last active November 9, 2018 03:06 — forked from chuyik/install.sh
Bandwagon(搬瓦工) CentOS 7 安装 shadowsocks-libev 和 kcptun
######################
## shadowsocks-libev
######################
# install dependencies
yum install epel-release -y
yum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto udns-devel libev-devel -y
# install shadowsocks-libev
cd /etc/yum.repos.d/
@defclass
defclass / humanize-schema-errors.clj
Created April 24, 2018 04:37 — forked from venantius/humanize-schema-errors.clj
Translate prismatic's schema.core errors to a human readable form. Use this for presenting validation errors to users. Don't use this for programming errors like a missing map key etc.
(ns x.y
(:use [plumbing.core]) ;; Just for the map-vals
(:require [clojure.walk :refer [postwalk prewalk prewalk-demo postwalk-demo]]
[clojure.core.match :refer [match]]
[schema.utils :refer [named-error-explain validation-error-explain]]
[schema.core :as s])
(:import (schema.utils NamedError ValidationError)))
;; Partially FROM:
;; https://github.com/puppetlabs/clj-schema-tools
@defclass
defclass / reflect.py
Created January 12, 2018 07:13 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):