Skip to content

Instantly share code, notes, and snippets.

View FrankFang's full-sized avatar
🎯
Focusing

Frank Fang FrankFang

🎯
Focusing
View GitHub Profile
# redis server
export name=redis-server-1
mkdir -p ./$name-conf
# copy config from https://redis.io/docs/management/config-file/
vim ./$name-conf/redis.conf
docker run --network network1 -v ./$name-data:/data -v ./$name-conf:/usr/local/etc/redis --name $name -d redis redis-server /usr/local/etc/redis/redis.conf --save 60 1 --loglevel warning
# redis client
docker run -it --network network1 --rm redis redis-cli -h redis-server-1
@FrankFang
FrankFang / lambda.js
Last active January 7, 2024 15:14
λ演算
ZERO = f => x => x
ONE = f => x => f(x)
TWO = f => x => f(f(x))
THREE = f => x => f(f(f(x)))
FOUR = f => x => f(f(f(f(x))))
FIVE = f => x => f(f(f(f(f(x)))))
SIX = f => x => f(f(f(f(f(f(x))))))
SEVEN = f => x => f(f(f(f(f(f(f(x)))))))
EIGHT = f => x => f(f(f(f(f(f(f(f(x))))))))
NINE = f => x => f(f(f(f(f(f(f(f(f(x)))))))))
code --install-extension 13xforever.language-x86-64-assembly
code --install-extension 2gua.rainbow-brackets
code --install-extension alefragnani.project-manager
code --install-extension alexcvzz.vscode-sqlite
code --install-extension antfu.browse-lite
code --install-extension antfu.unocss
code --install-extension antfu.vite
code --install-extension bung87.vscode-gemfile
code --install-extension castwide.solargraph
code --install-extension christian-kohler.npm-intellisense
import * as React from 'react'
declare module 'react' {
interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
flex?: boolean
relative?: boolean
text?: string
grid?: boolean
before?: string
after?: string
shadow?: boolean
{
"extends": "@antfu",
"rules": {
"curly": "off",
"arrow-parens": "off",
"@typescript-eslint/brace-style": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
@FrankFang
FrankFang / svgsprites.ts
Last active January 7, 2024 09:13
A Vite plugin for generating svg sprites
import path from 'path'
import fs from 'fs'
import store from 'svgstore'
import { optimize } from 'svgo'
import type { Plugin, ViteDevServer } from 'vite'
interface Options {
id?: string
inputFolder?: string
inline?: boolean
package main
import (
"fmt"
"math"
)
func main() {
var age int8 = 18 // -128 ~ 127
var daysToLive int16 = 10_000 // -32768 ~ 32767
@FrankFang
FrankFang / x11.sh
Created September 22, 2021 03:08
x11 on headless server
apk add libx11-dev
apk add xvfb
Xvfb :99 -screen 0 1024x768x24
export DISPLAY=:99.0
xclip -selection clipboard -t image/png -i dog.jpg
echo "123" | xclip -selection clipboard
<scheme name="Monokai - Frank" version="142" parent_scheme="Darcula">
<metaInfo>
<property name="created">2020-04-12T15:35:52</property>
<property name="ide">WebStorm</property>
<property name="ideVersion">2020.1.0.0</property>
<property name="modified">2020-12-09T16:19:39</property>
<property name="originalScheme">_@user_Monokai</property>
</metaInfo>
<colors>
<option name="CARET_COLOR" value="f8f8f0" />
; ! is Alt
; + is Shift
; ^ is Ctrl
; # is Win
F1::
Send {LWin Down}{1}{LWin Up}
return
CapsLock::SetCapsLockState, Off