Skip to content

Instantly share code, notes, and snippets.

View ylxdzsw's full-sized avatar
🐟
摸鱼

ylxdzsw

🐟
摸鱼
View GitHub Profile
@ylxdzsw
ylxdzsw / draw_dep.jl
Last active October 1, 2016 03:03
generate dot code that generates a graph of an abstract julia type
function draw_dep(T::Type; package_name::Bool=false, upper_bound::Bool=true)
_draw(T::ANY) = for t in subtypes(T)
print(g, " \"")
format_type(T)
print(g, "\" -> \"")
format_type(t)
println(g, '\"')
_draw(t)
end
@ylxdzsw
ylxdzsw / .zshrc
Last active February 11, 2020 16:39
my zsh config template
#=== Settings ===#
setopt AUTOCD
setopt AUTOPUSHD PUSHDMINUS PUSHDIGNOREDUPS
disable r
DIRSTACKSIZE=10
HISTFILE=~/.zsh_history
HISTSIZE=65535
@ylxdzsw
ylxdzsw / proxy.pac
Last active December 3, 2019 14:12
my pac file
// ylxdzsw's minimalistic pac
const [DIRECT, PROXY] = "__DIRECT__" == "__DIR" + "ECT__" // __xx__ will be replaced when used within some softwares
? ["DIRECT", "SOCKS5 localhost:1080"]
: ["__DIRECT__", "__PROXY__"]
const list = [
// frequent
/google/,
"github.com",
@ylxdzsw
ylxdzsw / combinePdfFiles.tex
Last active August 17, 2018 01:48 — forked from ppanyukov/combinePdfFiles.tex
Combine and rotate several PDF files into one using LaTeX (useful when you use a sucking scanner)
\documentclass[a4paper]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-, scale=1, angle=30]{p01.pdf}
\includepdf[pages=-, scale=1, angle=30]{p02.pdf}
\includepdf[pages=-, scale=1, angle=30]{p03.pdf}
\includepdf[pages=-, scale=1, angle=30]{p04.pdf}
\end{document}
@ylxdzsw
ylxdzsw / gist:9b4dab4a3548a2f67a53d93c5b235fb5
Created August 20, 2018 09:58
random list of some domains.txt
s: server, c: cdn, a: ad, t: tracker, o: other, u: unknown
a doubleclick.net
a adnxs.com
t google-analytics.com
c akamaihd.net
t fonts.gstatic.com
a dotomi.com
a lkqd.net
a advertising.com
@ylxdzsw
ylxdzsw / dns.jl
Created September 19, 2018 04:55
see if you got a bad dns server
using Fire
using Dates
using Base64
using Sockets
using OhMyJulia
using Statistics
import Base.adjoint # monky patch
adjoint(x::Unsigned) = ntoh(x)
@ylxdzsw
ylxdzsw / regen.lua
Created November 28, 2018 15:29
cheat engine regenerate
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
@ylxdzsw
ylxdzsw / pack_ico.jl
Created November 30, 2018 05:45
pack several .png files into an .ico flie in Julia.
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
@ylxdzsw
ylxdzsw / main.jl
Created December 9, 2018 13:31
bundle KaTeX fonts into css
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]))))}"))
uuzero: ⁰₀
uuone: ¹₁
uutwo: ²₂
uuthree: ³₃
uufour: ⁴₄
uufive: ⁵₅
uusix: ⁶₆
uuseven: ⁷₇
uueight: ⁸₈
uunine: ⁹₉