Skip to content

Instantly share code, notes, and snippets.

Kindy Lin kindy

  • ----
Block or report user

Report or block kindy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View README.md

Memory Compare

# Lua
1.3KB/Thread

10000   mem:1.28125KB     total:13641.189453125KB

# Luajit
0.5KB/Thread
View polyfill.document.createTreeWalker.js
/* eslint no-param-reassign: 0 */
/**
* JavaScript implementation of W3 DOM4 TreeWalker interface.
*
* See also:
* - https://dom.spec.whatwg.org/#interface-treewalker
*
* Attributes like "read-only" and "private" are ignored in this implementation
* due to ECMAScript 3 (as opposed to ES5) not supporting creation of such properties.
@kindy
kindy / gist:777f013083e101941d0684358529ca18
Created Aug 7, 2018 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.
View gist:777f013083e101941d0684358529ca18

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@kindy
kindy / repl.js
Created Jul 17, 2018
文本正则替换 模式
View repl.js
// 此处所列函数只是框架,实际使用仍需要调整和修正
// 提供的是一个思路
// 替换函数是同步的
function replSync(txt) {
let pick = (s, e) => txt.substring(s, e);
const re = /\w/g;
const buf = [];
let lastIdx = 0;
@kindy
kindy / README.md
Created Apr 25, 2018
Simple File Server(upload) / 简易文件服务器(支持上传)
View README.md

Simple File Server(upload) / 简易文件服务器(支持上传)

一般文件上传都会使用 Form 形式, 其实如果只是为了做一个简单的文件服务的话,那么可以简化许多。

Nginx 默认提供了文件访问服务,使用 autoindex 可以提供文件list 功能; 对于文件上传,使用 WebDAV模块可以极大简化上传的实现及用法。

Nginx 配置

@kindy
kindy / README.md
Created Apr 4, 2018 — forked from MoOx/README.md
How to keep in sync your Git repos on GitHub, GitLab & Bitbucket easily
View README.md
title tags authors
How to keep in sync your Git repos on GitHub, GitLab & Bitbucket easily
git
github
gitlab
bitbucket
MoOx
@kindy
kindy / raytracer.ts
Created Feb 21, 2018
AST Play assets
View raytracer.ts
class Vector {
constructor(public x: number, public y: number, public z: number) { }
static times(k: number, v: Vector) {
return new Vector(k * v.x, k * v.y, k * v.z);
}
static minus(v1: Vector, v2: Vector) {
return new Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
@kindy
kindy / emojis.js
Created Dec 25, 2017
emojis in js
View emojis.js
const emojis = [
0x1f201,
0x1f202,
0x1f21a,
0x1f22f,
0x1f232,
0x1f233,
0x1f234,
0x1f235,
0x1f236,
View get-copyright.js
View Apps Script Document Utilities.md

Google Apps Script Document Utilities

  • getAllLinks.js

  • getAllLinks(element) - returns array of all UrlLinks in Document

  • findAndReplaceLinks(searchPattern,replacement) - changes all matching links in Document

  • changeCase.js - Document add-in, provides case-change operations in the add-in Menu.

  • onOpen - installs "Change Case" menu

  • _changeCase - worker function to locate selected text and change text case. Case conversion is managed via callback to a function that accepts a string as a parameter and returns the converted string.

  • helper functions for five cases

You can’t perform that action at this time.