Skip to content

Instantly share code, notes, and snippets.

@luooooob
luooooob / meta-tags.md
Created February 13, 2023 19:12 — forked from whitingx/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@luooooob
luooooob / rec.c
Created July 18, 2022 19:02
尾递归教学
#include <stdio.h>
/** 求和 */
int sum_for(int i, int j) {
int k;
int sum = 0;
for(k = i; k <= j; k++) {
sum = sum + k;
}
@luooooob
luooooob / nginx-tuning.md
Created January 10, 2022 01:35 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@luooooob
luooooob / .eslintrc.json
Last active September 1, 2021 09:20
my-eslint
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"functional"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended",
import React from "react";
import { createPortal } from "react-dom";
function usePortal() {
const portalElRef = React.useRef(document.createElement("div"));
React.useEffect(() => {
document.body.appendChild(portalElRef.current);
return () => {
@luooooob
luooooob / calc.ts
Last active September 3, 2021 09:31
CSS Preset Values
enum Operator {
ADD = "+",
SUB = "-",
MUL = "*",
DIV = "/",
}
type Expression<O extends Operator> = `(${string} ${O} ${string})`
/* eslint-disable react-hooks/rules-of-hooks */
import { createContext, ReactNode, useContext, useEffect, useMemo, useState } from "react"
import type { Dispatch, FC } from "react"
const LOCALSTORAGE_KEY = "diandiandian-user-perfers-color-scheme"
type ColorScheme = string | null
@luooooob
luooooob / tileUtil.ts
Created April 14, 2019 14:25
conversion of tenhon-style string and number array
// 牌面代码转天凤字符串
export function tilesToTenhon(tiles: number[]) {
const getType = (tile: number) => Math.floor((tile - 1) / 9)
const getNum = (tile: number) => (((tile - 1) % 9) + 1)
const m = tiles.filter(tile => getType(tile) == 0).map(tile => getNum(tile))
const p = tiles.filter(tile => getType(tile) == 1).map(tile => getNum(tile))
const s = tiles.filter(tile => getType(tile) == 2).map(tile => getNum(tile))
const z = tiles.filter(tile => getType(tile) == 3).map(tile => getNum(tile))
@luooooob
luooooob / use.go
Created April 28, 2018 17:27 — forked from elithrar/use.go
go/use: Little middleware chains that could. Inspired by comments here: https://github.com/gorilla/mux/pull/36
r := mux.NewRouter()
// Single handler
r.HandleFunc("/form", use(http.HandlerFunc(formHandler), csrf, logging)
// All handlers
http.Handle("/", recovery(r))
// Sub-routers
apiMiddleware := []func(http.Handler) http.Handler{logging, apiAuth, json}