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 / 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
@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
@zhiyue
zhiyue / xiaoxiao_tts.py
Created April 7, 2022 06:59 — forked from xjohjrdy/xiaoxiao_tts.py
返回的音频没有文件头,所以我随便加的一个文件头,但显示的音频时长有问题。如果播放器不能正常播放,可以使用Chrome播放。
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from ws4py.client.threadedclient import WebSocketClient
import binascii
class WSClient(WebSocketClient):
def __init__(self, url, text, filename):
@zhiyue
zhiyue / setup-python3.8-via-ppa.sh
Created April 1, 2022 06:08 — forked from ptantiku/setup-python3.8-via-ppa.sh
Setup Python3.8 in Ubuntu Xenial (16.04 LTS). The python version was fixed at Python 3.5.1
#!/bin/sh
# install PPA
sudo add-apt-repository ppa:deadsnakes/ppa
# update and install
sudo apt update
sudo apt install python3.8 python3.8-dev python3.8-venv
# setup alternatives