Skip to content

Instantly share code, notes, and snippets.

View kanwei's full-sized avatar

Kanwei Li kanwei

  • Double the Donation
  • Atlanta, GA
View GitHub Profile
@kanwei
kanwei / README.md
Last active May 27, 2023 13:31
Building nginx 1.25 with QUIC/H3 on Debian 11
@kanwei
kanwei / README.txt
Created November 23, 2021 23:54
Running elasticsearch-full homebrew natively on Apple M1 Silicon
Edit /opt/homebrew/Cellar/elasticsearch-full/7.15.2/homebrew.mxcl.elasticsearch-full.plist
Make this change, with the proper JDK location:
<key>EnvironmentVariables</key>
<dict>
<key>ES_JAVA_HOME</key>
<string>/opt/homebrew/Cellar/openjdk/17.0.1/libexec/openjdk.jdk/Contents/Home</string>
</dict>
<script>
//Syracuse University
//Installing DTD tools for main donation form
//https://cusecommunity.syr.edu/s/1632/17/form/landing.aspx?sid=1632&gid=2&pgid=383&sitebuilder=1&contentbuilder=1
//Syracuse public API key
var DDCONF = {API_KEY: "YTQ4NDNhNTktYjIy"};
//loading the dtd script wipes out localstorage, so capture that data early
var dtd_streamlined_search_data = {};
@kanwei
kanwei / error.html
Created May 10, 2019 05:45
Zoho Sign Error
<!doctype html><html lang=\"en\"><head><title>HTTP Status 400 – Bad Request</title><style type=\"text/css\">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1><hr class=\"line\" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Request header is too large</p><p><b>Description</b> The server cannot or will not process the request due to something that is perceived to be a client error (e.g.
@kanwei
kanwei / track.php
Last active August 11, 2018 00:28 — forked from jedna/track.js
Track outbound links with Google Universal Analytics.js
add_action( 'wp_footer', 'google_analytics_link_tracking' );
function google_analytics_link_tracking() {
?>
<script type="text/javascript">
function _gaLt(event) {
/* If GA is blocked or not loaded, or not main|middle|touch click then don't track */
if (!ga.hasOwnProperty("loaded") || ga.loaded != true || (event.which != 1 && event.which != 2)) {
return;
}
R795W3GD.FW0:
GV-R795WF3-3GD/FW0
Subsystem Vendor ID: 1458
Subsystem ID: 254c
Object Header Structure Size: 389
Connector Object Table Offset: 48
Router Object Table Offset: 0
Encoder Object Table Offset: 118
@kanwei
kanwei / gist:9668005
Created March 20, 2014 16:32
Minimal case for jdbc leak
(ns montecarlo.web
(:require [yesql.core :refer :all]))
;; YESQL
(defquery test-query "s1.sql")
(def db-spec {:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:subname xxx
:user xxx
:password xxx})
@kanwei
kanwei / tourbuzz-paginator.coffee
Created October 22, 2013 16:03
Tourbuzz paginator
angular.module("tourbuzz.paginator", [])
.directive "paginator", ($parse) ->
return {
template: """<div ng-transclude></div>"""
transclude: true
controller: ($scope) ->
$scope.state = {page: 1, all: null, perPage: 10}
$scope.nextPage = -> $scope.state.page = parseInt($scope.state.page) + 1
$scope.prevPage = -> $scope.state.page = parseInt($scope.state.page) - 1
$scope.$watch("state" , (scope) ->
@kanwei
kanwei / removedups.clj
Created April 8, 2013 18:37
Clojure: Remove duplicates via a user-defined function
(defn remove-dups [f coll]
(vals
(reduce (fn [m v]
(let [applied (f v)]
(if-not (contains? m applied)
(assoc m applied v)
m)))
{}
coll)))
@kanwei
kanwei / gist:4696105
Last active December 12, 2015 02:08
HackerRank Median Clojure (passes)
(ns solution (:gen-class))
(set! *warn-on-reflection* true)
(defn median [^java.util.PriorityQueue max-heap ^java.util.PriorityQueue min-heap]
(let [max-size (.size max-heap)
min-size (.size min-heap)]
(cond
(and (zero? max-size)
(zero? min-size)) "Wrong!"