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 / sun8i-h3-ili9341-touchscreen.dts
Created September 1, 2024 21:56
Overlay file for ili9341 touchscreen module
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target = <&pio>;
__overlay__ {
spi0_cs1: spi0_cs1 {
@4piu
4piu / del-credential.ps1
Created May 30, 2024 20:37
Delete Windows credential with specified regex pattern
# Prompt the user for the pattern
$pattern = Read-Host "Delete Credential with Regex pattern"
# Filter credentials that start with the specified prefix
$regex = "^ Target: (?:LegacyGeneric:target=)*" + $pattern + "$"
$creds = cmdkey /list | Select-String -Pattern $regex
# Remove each credential that starts with the specified prefix
foreach ($cred in $creds) {
$target = $cred -replace "^\s*Target: ", ""
@4piu
4piu / script.user.js
Created May 19, 2024 18:17
Allow Oculus screen casting to be displayed in theater mode
// ==UserScript==
// @name Theater Mode
// @namespace http://tampermonkey.net/
// @version 2024-05-19
// @description Allow the video to occupy the whole webpage
// @author Nobody
// @match http*://*.oculus.com/casting
// @icon https://www.google.com/s2/favicons?sz=64&domain=oculus.com
// @grant none
// ==/UserScript==
@4piu
4piu / bmp2csv.py
Created March 6, 2024 17:31
Convert grayscale bitmap image to a csv where each cell is 0-255
#!/usr/bin/env python3
from PIL import Image
import csv
def convert_image_to_csv(image_path, csv_path):
# Open the image
with Image.open(image_path) as img:
# Convert image to grayscale (if it's not already)
img = img.convert('L')
@4piu
4piu / fill-screen-aspect-ratio-range.html
Created December 11, 2023 14:10
Fill screen with a div with a limited-range aspect ratio, and rotate 90 degree on portrait screen
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>My FullScreen App</title>
</head>
<body>
<div id="app">
<h1>My FullScreen App</h1>
@4piu
4piu / fill-screen-fixed-aspect-ratio.html
Last active December 11, 2023 13:12
Fill screen with a fixed-aspect-ratio div, and rotate 90 degree on portrait screen
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>My FullScreen App</title>
</head>
<body>
<div id="app">
<h1>My FullScreen App</h1>
@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