Skip to content

Instantly share code, notes, and snippets.

View zhiyue's full-sized avatar
🌻
just do it.

zhiyue zhiyue

🌻
just do it.
View GitHub Profile
@zhiyue
zhiyue / build.bat
Created May 11, 2023 10:08
bash to bat
@echo off
setlocal EnableDelayedExpansion
set process_name=%1
cd %process_name%
call :compile
call :make_output
@zhiyue
zhiyue / Enable UDP RDP Windows
Created February 2, 2023 13:32 — forked from version-control/Enable UDP RDP Windows
Enable UDP RDP Windows
Admin Priv
VM / Remote Machine
Enable-NetFirewallRule -DisplayName "Remote Desktop - User Mode (TCP-In)"
Enable-NetFirewallRule -DisplayName "Remote Desktop - User Mode (UDP-In)"
Laptop - Local Remote User
Set-ItemProperty 'HKLM:/Software/Policies/Microsoft/Windows NT/Terminal Services/Client' 'fClientDisableUDP' 0
@zhiyue
zhiyue / nvidia-docker-2.yml
Created January 19, 2023 09:50 — forked from dholt/nvidia-docker-2.yml
Simple Ansible playbook for installing nvidia-docker-2 and setting it as the default runtime for Docker
- hosts: all
become: true
become_method: sudo
vars:
daemon_json:
bip: 192.168.99.1/24
default-runtime: nvidia
runtimes:
nvidia:
path: /usr/bin/nvidia-container-runtime
@zhiyue
zhiyue / resize-sdcard-partitions.md
Created December 5, 2022 10:48 — forked from sxiii/resize-sdcard-partitions.md
Resize linux partition that was written by DD or similar instrument to use all available space

Please run the following commands to resize a partition.
IMPORTANT NOTE: Don't forget to change partition address from /dev/sdb2 to your actual partition!
CHANGES ARE DONE IN TWO OR THREE PLACES.
Example below are for /dev/sdb2 partition which is called like "/dev/sdb 2" for growpart
and like "/dev/sdb2" for resize2fs & e2fsck.
Requirements: * growpart; * resize2fs; * e2fsck if disk requires checking.
Install growpart in arch/manjaro: pikaur -S growpart (resize2fs and e2fsck are usually bundled with OS)

sudo growpart /dev/sdb 2
@zhiyue
zhiyue / proxy.worker.js
Created June 13, 2022 08:00 — forked from abersheeran/proxy.worker.js
A proxy download cloudflare worker
addEventListener("fetch", (event) => {
event.respondWith(
handleRequest(event.request).catch(
(err) => new Response(err.stack, { status: 500 })
)
);
});
async function handleRequest(request) {
console.log(`${request.method} ${request.url}`)
@zhiyue
zhiyue / docker-compose.yaml
Created May 30, 2022 11:30 — forked from fogx/docker-compose.yaml
Broken Traefik - Cloudflare
version: "3"
services:
traefik:
#https://www.smarthomebeginner.com/traefik-2-docker-tutorial/
image: traefik:latest
container_name: traefik
command: # CLI arguments
- --global.sendAnonymousUsage=false
- --api=true

ws: a Node.js WebSocket library

Version npm Build Windows x86 Build Coverage Status

ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and server implementation.

@zhiyue
zhiyue / tmcleanup.md
Created May 6, 2022 07:28 — forked from blanboom/tmcleanup.md
Script to automatically remote old Mac OSX Time Machine Backups older than a specified number of days

Prerequisites

  • gfind (via brew install findutils)
  • Time Machine drive mounted on your computer (or you can change path from standard /Volume/Time\ Machine\ Backups/Backups.backup.db/
  • Admin/sudo access in the OSX terminal

Script

  • Be sure to set the correct machine name. You can check the actual folder things are going into by looking in the backup location.
  • By default, it erases all backups older than 30 days. Adjust as desired.
@zhiyue
zhiyue / cloudflared.yaml
Created April 8, 2022 07:51 — forked from a1994sc/cloudflared.yaml
cloudflared - k3s
---
apiVersion: apps/v1
#kind: Deployment
kind: DaemonSet
metadata:
name: cloudflared
namespace: ingress
labels:
group: cloudflare
spec:
@zhiyue
zhiyue / xiaoxiao_tts.py
Created April 7, 2022 07:30 — forked from Lulalaby/xiaoxiao_tts.py
superb edit of an old parameterless script
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""Edge Microsoft TTS for Python."""
import sys
from ws4py.client.threadedclient import WebSocketClient
import binascii
import argparse
import json
import requests
import re