Skip to content

Instantly share code, notes, and snippets.

View shellj's full-sized avatar
:octocat:
Working

Jun Xie shellj

:octocat:
Working
View GitHub Profile
@shellj
shellj / font.py
Last active November 10, 2023 06:57
fontforge 精简 fontawesome 字体
# 需要使用 fontforge 的 ffpython 执行
import fontforge
# 可以在 fontawesome.com 找到 glyph ,字体里面 glyphname 加了 uni 前缀
glyphs = [
"unif09a", #facebook
"unif099", #twitter
"unif16d", #instagram
"unie07b", #tiktok
"unif09b", #github
"unif167", #youtube
@shellj
shellj / table_difference.sql
Created September 5, 2022 09:27
get the difference between two tables in MySQL
SELECT table_name,
column_name,
ordinal_position,
data_type,
column_type,
COLUMN_DEFAULT,
COLUMN_COMMENT
FROM (SELECT table_name,
column_name,
ordinal_position,
@shellj
shellj / snowflake-id-generator.sql
Last active August 18, 2022 06:05
Postgresql snowflake id generator
create schema shard_1;
create sequence shard_1.global_id_sequence;
CREATE OR REPLACE FUNCTION shard_1.id_generator(OUT result bigint) AS $$
DECLARE
seq_len int := 14;
shard_len int := 1;
seq_max bigint := pow(2, seq_len);
-- 2022-08-08
@shellj
shellj / dos2unix.sh
Created January 5, 2021 09:16 — forked from jappy/dos2unix.sh
Shell script to convert files with CRLF to LF (Mac/Linux)
#! /bin/sh
for x
do
echo "Converting $x"
tr -d '\015' < "$x" > "tmp.$x"
mv "tmp.$x" "$x"
done
@shellj
shellj / user-rule.txt
Created April 29, 2020 09:53
user-rule.txt
.google
.github.com
.githubusercontent.com
.githubassets.com
||postman.com
||polyfill.io
||steem.ninja
||3speak.online
||cnsteem.io
.github.io
@shellj
shellj / error.log
Created April 22, 2020 03:26
reCAPTCHA v3 Invalid site key or not loaded in api.js
recaptcha__zh_cn.js:534 Uncaught Error: Invalid site key or not loaded in api.js: xxxxxxx
" vim-bootstrap
"*****************************************************************************
"" Vim-PLug core
"*****************************************************************************
let vimplug_exists=expand('~/.vim/autoload/plug.vim')
let g:vim_bootstrap_langs = "rust"
let g:vim_bootstrap_editor = "vim" " nvim or vim
@shellj
shellj / hanoi.py
Created June 3, 2017 09:48
汉诺塔
# https://zh.wikipedia.org/wiki/%E6%B1%89%E8%AF%BA%E5%A1%94
# 分为3步进行
# 1. 将a上面的n-1个移到b上(c作为中转)
# 2. 将a上面的那一个移到c上
# 3. 将b上的那n-1个移到c上(a作为中转)
# 所以这个函数的四个参数为,n:层数 a:需要移动的一堆盘子 b:中转站 c:目标塔。
# 注意形参和实参
def hanoi(n, a='A', b='B', c='C'):
if n == 1:
print('move', a, '-->', c)