This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adapta-maia-theme | |
aircrack-ng | |
android-tools | |
aria2 | |
bat | |
chromium-ozone | |
cmake | |
code | |
coffeescript | |
coreutils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For me, the history is mainly used as a completion dict when I press the up arrow. | |
# This script removes the lines that does not help serve this purpose | |
entries = readlines("$(homedir())/.zsh_history") | |
commands = Set(readlines(`zsh -ic 'print -rl -- ${(k)aliases} ${(k)functions} ${(k)builtins} ${(k)commands}'`)) | |
filter_but_keep_multiline(f, iter) = let skip = false | |
filter(iter) do line | |
if skip | |
skip = endswith(line, '\\') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/pkexec /usr/bin/zsh | |
set -x | |
# clean up before backing up | |
pacman -Sc | |
journalctl --vacuum-time=7d | |
rm /var/lib/systemd/coredump/* | |
# backup based on last previous one to save disk space | |
TARGET=/run/media/ylxdzsw/DATA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const box1 = ('红', '红') | |
const box2 = ('红', '蓝') | |
const box3 = ('蓝', '蓝') | |
另一个也是红球的次数 = 0 | |
总试验次数 = 0 | |
while 总试验次数 < 100_000 | |
# 随机抽取一个盒子 | |
box = rand([box1, box2, box3]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using JSON2 | |
using OhMyJulia | |
using ProgressMeter | |
f = open("maintain.tsv", "w") | |
prt(f, "service", "category", "product", "type", "tip", "info", "tags", | |
"brand", "order_quantity", "sales_quantity", "comments", "price", "marketing_price", "unit", "name", "rate", "remark") | |
import Base.print |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Statistics | |
const p = run(pipeline(`arecord -f cd -t raw`, stdout=Pipe()), wait=false) | |
close(p.out.in) | |
while true | |
sleep(0.1) | |
x = reinterpret(Int16, readavailable(p.out)) | |
x = @. 20log(10, abs(max(x, typemin(Int16) + one(Int16))) / typemax(Int16)) | |
println(mean(x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uuzero: ⁰₀ | |
uuone: ¹₁ | |
uutwo: ²₂ | |
uuthree: ³₃ | |
uufour: ⁴₄ | |
uufive: ⁵₅ | |
uusix: ⁶₆ | |
uuseven: ⁷₇ | |
uueight: ⁸₈ | |
uunine: ⁹₉ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Base64 | |
write("katex.css", replace(read("katex.min.css", String), r"fonts/[^.]+\.woff2.*?}" => s -> "data:font/woff2;base64,$(base64encode(read(s[1:findfirst(x->x==')', s)-1]))))}")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pack_ico(io::IO, pngs::Bytes...) | |
# all values are in little endian | |
# header | |
write(io, 0x0000) # reserved to be 0 | |
write(io, 0x0001) # 1 for .ico, 2 for .cur | |
write(io, length(pngs) % UInt16) # number of images | |
# image directory | |
c = 6 + 16length(pngs) # offsets of current image, initial value is the header length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function regen(t) | |
local cv1 = readInteger(0x93CCB120) | |
local cv2 = readInteger(0x93CCB0E4) | |
if cv1 < 34 then | |
writeInteger(0x93CCB120, cv1 + 1) | |
end | |
if cv2 < 4 then | |
writeInteger(0x93CCB0E4, cv2 + 1) | |
end | |
end |