Skip to content

Instantly share code, notes, and snippets.

View zoonderkins's full-sized avatar
🏠
Working 👍

Quack~ zoonderkins

🏠
Working 👍
View GitHub Profile
@zoonderkins
zoonderkins / awesome-ublock-rules.md
Last active March 12, 2019 12:37
Awesome-uBlock-rules #adblock

Edited: 2018-03-12

News

Washingtonpost.com

||washingtonpost.com/*/adblocker-feature^$xhr

Bostonglobe.com

Script block

@zoonderkins
zoonderkins / linux-change-keyboard-layout-to-us.md
Created February 21, 2019 11:27
Linux change keyboard layout to US #linux

hetzner cloud vps

By default, it comes with DE keyboard. It kinda a pain in the ass...

So easy way to change to US keyboard layout, follow this few steps

// not recommend this
dpkg-reconfigure keyboard-configuration
@zoonderkins
zoonderkins / require-js.js
Last active February 20, 2019 15:43
require-js #javascript
// License belongs to @serapath
// https://gistcdn.githack.com/ookangzheng/98af01a88a0ab8937d24e12f0c5d307e/raw/afb42195ba4f1542d2dffe634179458a79de9c11/require-js.js
// CDN: https://yerl.org/nLBxY
window.require = (function (modules) {
function init (name, _module) {
var se = document.createElement('script')
var module = JSON.parse(_module)[name]
se.text = module.bundle
document.head.appendChild(se)
// JavaScript 字符串编码使用 UTF-16
"💩".length === 2;
"💩" === "\u{1F4A9}"; // es6
"💩" === "\uD83D\uDCA9"; // es5
// 同一个编码可能使用不同的码位
"ò" === "ò"; // ❎
"ò" === "\xF2"; // ✅
"ò" === "o\u0300"; // ✅
"o\u0300".normalize("NFC") === "\xF2"; // ✅ es6 提供了 normalize 函数
@zoonderkins
zoonderkins / dig-edns-client-subnet.md
Created February 16, 2019 13:52
Dig EDNS client subnet #linux

Cmd

dig +subnet=108.61.201.119 @80.80.80.80 o-o.myaddr.test.l.google.com txt +short
dig @::1 -p 52 icnerd-1e5f.kxcdn.com +subnet=108.61.201.0/24
@zoonderkins
zoonderkins / reroute-local-dns-to-ur-custom-dns.md
Last active February 16, 2019 13:53
Reroute local DNS to your custom DNS #linux
iptables -t nat -A PREROUTING -i eth0 -p udp ! --source 192.168.2.196 ! --destination 192.168.2.196 --dport 53 -j DNAT --to 192.168.2.196

iptables -t nat -A PREROUTING -i eth0 -p tcp ! --source 192.168.2.196 ! --destination 192.168.2.196 --dport 53 -j DNAT --to 192.168.2.196

or 

iptables -t nat -I PREROUTING -i br-lan -p tcp --dport 53 -j DNAT --to 192.168.2.4:53
iptables -t nat -I PREROUTING -i br-lan -p udp --dport 53 -j DNAT --to 192.168.2.4:53
@zoonderkins
zoonderkins / git-refusing.md
Last active December 29, 2020 22:31 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

Git refusing to merge unrelated histories on rebase

Error: fatal: refusing to merge unrelated histories

Solution:

  • Rebase it git pull --rebase branchname

  • pull git pull origin branchname --allow-unrelated-histories

  • push git push origin master

@zoonderkins
zoonderkins / Linux-grep-text-in-file.md
Created February 6, 2019 02:30
Linux grep find text in file #linux

How to grab a keyword or text in linux and print it out?!

// First and Recommended
grep -rnw '/path/to/somewhere/' -e 'pattern'

-r or -R is recursive,
-n is line number, and
-w stands for match the whole word.
-l (lower-case L) can be added to just give the file name of matching files.
@zoonderkins
zoonderkins / gitignore-fix-directory-not-working.md
Created February 2, 2019 13:11
gitignore fix not working in a directory #git

Do the following to trigger the gitignore

Step 1: Commit all your pending changes in the repo which you want to fix and push that.

Step 2: Now you need to remove everything from the git index in order to refresh your git repository. This is safe. Use this command:

git rm -r --cached . Step 3: Now you need to add everything back into the repo, which can be done using this command:

git add .

@zoonderkins
zoonderkins / mac-flutter-path.md
Last active September 6, 2024 03:47
Mac-flutter-path #mac

Make flutter cmd run in zsh

// When you downloaded flutter sdk, unzip it to ~/flutter
// Add to ~/.bash_profile
nano .bash_profile
export PATH="$PATH:/Users/lol/development/flutter/bin"

// save 
soure ~/.bash_profile