Skip to content

Instantly share code, notes, and snippets.

View czlc's full-sized avatar

czlc czlc

  • None
View GitHub Profile
@czlc
czlc / win-ss
Last active April 17, 2022 15:12 — forked from dreamlu/win-ss
windows终端翻墙,简易方式
环境:shadowsocks、windows
本地ss端口设置(这里1080)
cmd命令行:(不用socks5)(临时设置)(也可放置环境变量)
set http_proxy=http://127.0.0.1:58591
set https_proxy=http://127.0.0.1:58591
ps:一定要用cmd命令行,千万别用powershell !!!
简易测试命令:curl https://www.google.com(别用ping)
@czlc
czlc / private_fork.md
Created September 22, 2021 06:34 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@czlc
czlc / nbt.lua
Created August 22, 2018 13:02 — forked from pingbird/nbt.lua
Lua NBT encoder and decoder
--[[
Lua NBT encoding and decoding by PixelToast, public domain
example output (serialized) from a player.dat: http://hastebin.com/kogupimizi.txt
requires string.pack/string.unpack
note: nbt is usually gzipped, you must inflate it before decoding
]]
nbt={}
@czlc
czlc / delete_git_submodule.md
Created April 7, 2018 03:21 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
function string.fromhex(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end
function string.tohex(str)
return (str:gsub('.', function (c)
return string.format('%02X', string.byte(c))
end))
@czlc
czlc / unicode.c
Last active January 6, 2022 12:44
#include <stdint.h>
static const char trailingBytesForUTF8[256] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
@czlc
czlc / luacs.md
Last active January 4, 2018 07:59
luacs

Lua 代码风格指南

格式化

  • 行首使用4字母缩进(Lua 推荐的是2字母)
  • 行长度不要超过80个字符
  • 不要用分号避免换行
-- bad
local whatever = 'sure';
1.从offx,offy位置裁剪width, height 区域
-crop width x height + offx + offy
union {
struct sprite * children[1];
struct rich_text * rich_text;
int scissor;
struct anchor_data *anchor;
struct pack_polygon *polygon;
} data;
int
/* 部件描述,顶点数是85个,用#uvs / 2计算,(vertices包括被各个骨骼影响的权重所以不是真实顶点数) */
"raptor_body": {
"raptor_body": {
"type": "skinnedmesh",
"uvs": [ 0.89014, 0.11136, 1, 0.22194, 1, 0.42847, 0.88179, 0.38589, 0.874, 0.47986, 0.84783, 0.51728, 0.82504, 0.54984, 0.82403, 0.61606, 0.82305, 0.67972, 0.74042, 0.86709, 0.61596, 0.93097, 0.49649, 0.90968, 0.41186, 0.71379, 0.36955, 0.70086, 0.32823, 0.68824, 0.30082, 0.69962, 0.27515, 0.71028, 0.25301, 0.71948, 0.22568, 0.73082, 0.20832, 0.72362, 0.19092, 0.7164, 0.15952, 0.70337, 0.1301, 0.69116, 0.09227, 0.67546, 0.06029, 0.63165, 0.02855, 0.58817, 0, 0.49874, 0.05045, 0.53494, 0.08267, 0.54507, 0.11815, 0.55623, 0.14733, 0.54161, 0.17913, 0.52568, 0.20324, 0.5136, 0.22867, 0.50087, 0.24871, 0.47664, 0.27523, 0.44458, 0.32026, 0.39015, 0.37517, 0.35747, 0.43476, 0.32201, 0.4893, 0.35534, 0.56021, 0.39867, 0.61587, 0.40674, 0.67769, 0.4157, 0.69094, 0.31314, 0.69362, 0.14742, 0.79219, 0.08354, 0.51541, 0.74573, 0.62393, 0.75425, 0.70856, 0.7287, 0.76132, 0.63288, 0.7566, 0.49454,