Skip to content

Instantly share code, notes, and snippets.

View 4piu's full-sized avatar
ROLLING BACK

4piu 4piu

ROLLING BACK
View GitHub Profile
@4piu
4piu / pwa-everything.user.js
Last active April 13, 2024 14:03 — forked from evanreichard/pwa-everything.user.js
pwa-everything.user.js
// ==UserScript==
// @name PWA Everything
// @author Evan Reichard
// @version 0.0.1
// @match *://*/*
// @grant none
// @run-at document-idle
// @noframes
// ==/UserScript==
@4piu
4piu / synology-wireguard.sh
Created May 21, 2023 08:21
How to Setup Wireguard VPN on Synology using Docker (without compiling/installing packages)
# The following command starts a wireguard-go container using wg0.conf
# I still can't find a boringtun container that works for Synology DSM 7.1
sudo docker run -d \
--cap-add NET_ADMIN \
--device=/dev/net/tun \
-v ❗/volume1/docker/wireguard/wg0.conf❗:/etc/wireguard/wg0.conf \
--sysctl net.ipv4.ip_forward=1 \
--name wireguard-go \
masipcat/wireguard-go
@4piu
4piu / Fix-NordVPN-IKEv2.reg
Created May 8, 2023 10:00
Fix NordVPN "policy mismatch" error when connecting use IKEv2 in Windows 10
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RasMan\Parameters]
"NegotiateDH2048_AES256"=dword:00000002
@4piu
4piu / crontab
Created November 17, 2022 02:40
Use nvm in cron
# load nvm && go to working dir && use .nvmrc && execute script
* * * * * . ~/.nvm/nvm.sh && cd /tmp/ && nvm use && /tmp/test.js >> /tmp/test.js.log 2>&1
@4piu
4piu / dvd.html
Last active March 1, 2022 02:09
Bouncing DVD logo (credits: WEB CIFAR https://codepen.io/Web_Cifar/pen/JjXrLRJ)
<html>
<body>
<section>
<svg class="logo" viewBox="0 0 16 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.4 4.959C3.268 4.959 0 5.509 0 6.186C0 6.864 3.268 7.413 7.4 7.413C11.532 7.413 14.943 6.864 14.943 6.186C14.944 5.508 11.533 4.959 7.4 4.959ZM7.263 6.51C6.306 6.51 5.53 6.273 5.53 5.98C5.53 5.687 6.306 5.45 7.263 5.45C8.22 5.45 8.995 5.687 8.995 5.98C8.995 6.273 8.219 6.51 7.263 6.51ZM13.319 0.052002H9.701L7.769 2.291L6.849 0.0830021H1.145L0.933 1.045H3.202C3.202 1.045 4.239 0.909002 4.273 1.739C4.273 3.177 1.897 3.055 1.897 3.055L2.341 1.555H0.869L0.194 3.988H2.862C2.862 3.988 5.683 3.738 5.683 1.77C5.683 1.77 5.797 1.196 5.749 0.943002L7.124 4.62L10.559 1.055H13.165C13.165 1.055 13.963 1.123 13.963 1.74C13.963 3.178 11.604 3.028 11.604 3.028L11.969 1.556H10.682L9.946 3.989H12.399C12.399 3.989 15.465 3.799 15.465 1.71C15.465 1.709 15.404 0.052002 13.319 0.052002Z" />
</svg>
</section>
<style type="text/css">
* {
padding: 0;
@4piu
4piu / update-dat.ps1
Created January 23, 2022 02:57
Update geoip and geosite dat file for Xray
# remote url
$GEOIP_URL="https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/geoip.dat"
$GEOSITE_URL="https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/geosite.dat"
# resource path
$GEOIP_PATH="C:\Users\WD-40\AppData\Local\qv2ray\vcore\geoip.dat"
$GEOSITE_PATH="C:\Users\WD-40\AppData\Local\qv2ray\vcore\geosite.dat"
# backup path
$GEOIP_BACKUP=$GEOIP_PATH+".bak"
$GEOSITE_BACKUP=$GEOSITE_PATH+".bak"
@4piu
4piu / sync.sh
Last active November 10, 2021 04:47
Sync large project using rsync with respect to gitignore
#!/usr/bin/env bash
# https://stackoverflow.com/questions/13713101/rsync-exclude-according-to-gitignore-hgignore-svnignore-like-filter-c
SOURCE="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
TARGET=user@remote:/path/to/my/blog
rsync --delete-after --filter=":e- .gitignore" --filter "- .git/" -a --progress $SOURCE/ $TARGET
@4piu
4piu / netns.sh
Last active November 1, 2021 09:58
Create A Network Namespace Using a Bypass Gateway
#!/usr/bin/env sh
NAMESPACE=proxy
GATEWAY=172.16.1.15
STATIC_IP= #172.16.1.97/24
DNS_SERVER=172.16.1.1
# check root permission
if [ "$(id -u)" != "0" ]; then
echo "Please run as root"
@4piu
4piu / netns.sh
Created November 1, 2021 08:00
Create A Network Namespace with the NATed Internet
#!/usr/bin/env sh
NAMESPACE=nat
VETH_IP_HOST=10.0.0.1/24
VETH_IP_NS=10.0.0.2/24
# check root permission
if [ "$(id -u)" != "0" ]; then
echo "Please run as root"
exit 1
@4piu
4piu / invoke.sh
Created November 1, 2021 05:45
Invoke function in sh
#!/usr/bin/env sh
a () {
echo "invoke a"
}
b () {
echo "invoke b"
}