Skip to content

Instantly share code, notes, and snippets.

View ouuan's full-sized avatar

Yufan You ouuan

View GitHub Profile
@parrot409
parrot409 / _writeup.md
Last active December 30, 2025 06:29
Impossible Leak - SECCON 2025 Quals

XS Leaks using disk cache grooming

The admin bot creates a new browsing context with createBrowsingContext() and uses that to create a page. Each browsing context should have a dedicated disk cache but how does chrome handle this? I deduced that it uses in-memory disk cache and it's much smaller than the default on-disk disk cache. The incognito tab of my browser has the same behavior.

The following page alerts "not cached" due to cache miss in incognito mode but no error happens in a regular tab.

$ head /dev/urandom -c 5242880 > chunk
$ cat <<EOF > index.html
@ouuan
ouuan / translate.sh
Last active December 3, 2025 07:30
Xorg (Linux) 任意窗口划词翻译
#!/bin/bash
# X.Org 任意窗口划词翻译
# 在 DE/WM 中设置快捷键执行
# 分单词和句子两种模式,notification 中显示的都是 Google 翻译的结果,但单词附带百度翻译的链接,句子附带 Google 翻译的链接
# notification 中附带的链接是否能点开依赖于 notification daemon,dunst 需要在设置中的 `mouse_left_click` 处加上 `open_url`
# 翻译的单词连同日期和窗口标题会记录在 ~/.cache/translated-words.txt
# 可以使用 http_proxy 环境变量设置代理
# notification 的 appname 是 "xorg-translate",在 dunst 中可以对其进行配置,例如设置图标
#
@ouuan
ouuan / autopause.sh
Last active June 18, 2021 07:15
Auto-pause players on pulseaudio sink remove
#!/bin/bash
LANG=C pactl subscribe | grep --line-buffered "Event 'remove' on sink" | xargs -L1 playerctl -a pause
@ouuan
ouuan / take-a-break.sh
Last active May 1, 2021 02:55
Take a break from your Xorg session
#!/bin/bash
# In <duration> seconds, if you have been unlocked for more than <permit> seconds, you'll be locked;
# if you have been unlocked for more than <warning> seconds, you'll be asked to lock every <dialoginterval> seconds.
# The stats are saved at <file>.
duration=3600
permit=3200
warning=2800
dialoginterval=180
@ouuan
ouuan / yay_cd.sh
Last active June 8, 2021 13:24
Get rid of your yay addiction
# https://gist.github.com/ouuan/c88295eea5dd89feecd712e8005d9dfa
# the package dateutils is required for the datediff command
# $1: the command
# $2: the short name of the command
# $3: the command to eval when it's in cd
# $COMMAND_CD_PATH: the path to save the cd time, default is $HOME/.command_cd_<short name or full command>
# $COMMAND_CD_LENGTH: cd length in nanoseconds, default is one hour
command_cd() {
@Scrumplex
Scrumplex / 50-udisks.rules
Last active November 9, 2025 20:43
Polkit rules for udisks, and udisks2. Compatible with udiskie and Dolphin.
// Original rules: https://github.com/coldfix/udiskie/wiki/Permissions
// Changes: Added org.freedesktop.udisks2.filesystem-mount-system, as this is used by Dolphin.
polkit.addRule(function(action, subject) {
var YES = polkit.Result.YES;
// NOTE: there must be a comma at the end of each line except for the last:
var permission = {
// required for udisks1:
"org.freedesktop.udisks.filesystem-mount": YES,
"org.freedesktop.udisks.luks-unlock": YES,
@anamewing
anamewing / cleveref-chinese.tex
Last active August 23, 2025 14:01
Add Simplified Chinese translation to cleveref.
\crefname{equation}{式}{式}
\crefname{figure}{图}{图}
\crefname{table}{表}{表}
\crefname{page}{页}{页}
\crefname{chapter}{章}{章}
\crefname{section}{节}{节}
\crefname{appendix}{附录}{附录}
\crefname{theorem}{定理}{定理}
\crefname{lemma}{引理}{引理}
\crefname{corollary}{推论}{推论}
@rvl
rvl / git-pushing-multiple.rst
Created February 9, 2016 11:41
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@amitchhajer
amitchhajer / Count Code lines
Created January 5, 2013 11:08
Count number of code lines in git repository per user
git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active December 30, 2025 02:28
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1