Skip to content

Instantly share code, notes, and snippets.

View kindy's full-sized avatar

Kindy Lin kindy

  • Beijing, China
  • 00:01 (UTC +08:00)
  • LinkedIn in/kindy
View GitHub Profile
@XVilka
XVilka / TrueColour.md
Last active April 27, 2025 10:17
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@hgfischer
hgfischer / benchmark+go+nginx.md
Last active January 6, 2025 09:05
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI

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

@mkottman
mkottman / cacert.pem
Last active April 10, 2020 13:44
A simple Lua IMAP client. Prerequisites: LuaSocket and LuaSec
##
## ca-bundle.crt -- Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Sat Dec 29 20:03:40 2012
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt). This file can be found in the mozilla source tree:
## http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1
##
@mashpie
mashpie / i18n-express-mustache-app.js
Last active September 26, 2018 16:31
express + i18n-node + mustache (via consolidate.js) and avoid concurrency issues
// require modules
var express = require('express'),
i18n = require('../../i18n'),
url = require('url'),
cons = require('consolidate'),
app = module.exports = express();
// minimal config
i18n.configure({
locales: ['en', 'de'],
@Integralist
Integralist / regex.js
Created March 11, 2013 15:15
The difference between JavaScript's `exec` and `match` methods is subtle but important, and I always forget...
var str = "The quick brown fox jumped over the box like an ox with a sox in its mouth";
str.match(/\w(ox)/g); // ["fox", "box", "sox"]
// match (when used with a 'g' flag) returns an Array with all matches found
// if you don't use the 'g' flag then it acts the same as the 'exec' method.
str.match(/\w(ox)/); // ["fox", "ox"]
/\w(ox)/.exec(str); // ["fox", "ox"]
@mbostock
mbostock / .block
Last active February 26, 2019 22:35
Rotating Voronoi
license: gpl-3.0
redirect: https://observablehq.com/@mbostock/rotating-voronoi
@rtrcolin
rtrcolin / jiraRefreshTickets.js
Last active January 8, 2024 13:59
Super simple Google Docs integration with Jira Issues/Tickets
// URL for Jira's REST API for issues
var getIssueURL = "https://[Your Jira host]/rest/api/2/issue/";
// Personally I prefer the script to handle request failures, hence muteHTTPExceptions = true
var fetchArgs = {
contentType: "application/json",
headers: {"Authorization":"Basic [Your BASE64 Encoded user:pass]"},
muteHttpExceptions : true
};
@dxflygao
dxflygao / trie.c
Created November 13, 2012 07:32 — forked from devyn/trie.c
#include "trie.h"
void trie_create (trie_t **trie, char edgeName, trie_t *previousSibling, trie_t *parent)
{
*trie = calloc(1, sizeof(struct trie));
(*trie)->edgeName = edgeName;
if (previousSibling == NULL) {
if (parent != NULL) parent->firstChild = *trie;
@devyn
devyn / trie.c
Created November 13, 2012 06:56
#include "trie.h"
void trie_create (trie_t **trie, char edgeName, trie_t *previousSibling, trie_t *parent)
{
*trie = calloc(1, sizeof(struct trie));
(*trie)->edgeName = edgeName;
if (previousSibling == NULL) {
if (parent != NULL) parent->firstChild = *trie;