Skip to content

Instantly share code, notes, and snippets.

View dongfg's full-sized avatar
🎯
Focusing

dongfg dongfg

🎯
Focusing
View GitHub Profile
@dongfg
dongfg / demo.py
Last active December 18, 2025 14:01
Raspberry Pi ST7796 SPI Demo
import time
import spidev
import RPi.GPIO as GPIO
from PIL import Image, ImageDraw, ImageFont
# --- 配置引脚 (BCM 编码) ---
DC_PIN = 24
RST_PIN = 25
BL_PIN = 17
SPI_BUS = 0
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<!--https://schneegans.de/windows/unattend-generator/?LanguageMode=Interactive&ProcessorArchitecture=amd64&BypassRequirementsCheck=true&BypassNetworkCheck=true&ComputerNameMode=Script&ComputerNameScript=return+Read-Host+-Prompt+%27Enter+computer+name%27%3B&CompactOsMode=Default&TimeZoneMode=Explicit&TimeZone=China+Standard+Time&PartitionMode=Interactive&DiskAssertionMode=Skip&WindowsEditionMode=Generic&WindowsEdition=pro&InstallFromMode=Automatic&PEMode=Default&UserAccountMode=Unattended&AccountName0=dongfg&AccountDisplayName0=&AccountPassword0=&AccountGroup0=Administrators&AutoLogonMode=Own&PasswordExpirationMode=Unlimited&LockoutMode=Default&HideFiles=Hidden&ShowFileExtensions=true&ClassicContextMenu=true&LaunchToThisPC=true&ShowEndTask=true&TaskbarSearch=Hide&TaskbarIconsMode=Default&DisableWidgets=true&LeftTaskbar=true&HideTaskViewButton=true&DisableBi
@dongfg
dongfg / dy365.js
Last active September 22, 2025 00:37
scriptable 每日任务组件
const widget = new ListWidget();
const STORAGE_KEY_PREFIX = "douyinCheckinStatus";
function storageKey() {
const date = new Date().toLocaleDateString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit'
});
return STORAGE_KEY_PREFIX + date;
@dongfg
dongfg / cnb.workspaces.clear.js
Created August 26, 2025 06:30
一键清空CNB云原生开发记录!
// ==UserScript==
// @name 清空云原生开发记录
// @namespace http://tampermonkey.net/
// @version 2025-08-26
// @description 一键清空云原生开发记录!
// @author dongfg
// @match https://cnb.cool/u/*/workspaces
// @icon https://www.google.com/s2/favicons?sz=64&domain=cnb.cool
// @grant none
// ==/UserScript==
@dongfg
dongfg / wsl-host-proxy.plugin.zsh
Created June 24, 2025 05:52
自动在 WSL 中根据宿主机网关动态设置 http_proxy 和 https_proxy
# WSL Host Proxy zsh Plugin
# Description: 自动在 WSL 中根据宿主机网关动态设置 http_proxy 和 https_proxy
# Usage:
# 1. 将此文件放到 ~/.oh-my-zsh/custom/plugins/wsl-host-proxy/wsl-host-proxy.plugin.zsh
# 2. 在 ~/.zshrc 的 plugins=(...) 中添加 "wsl-host-proxy"
# 3. 重新加载 zsh:`source ~/.zshrc`
# ===== 配置 =====
# 可在 ~/.zshrc 中自定义 PROXY_PORT(默认 7890)
: ${PROXY_PORT:=7890}
@dongfg
dongfg / sshkeys.sh
Created January 10, 2025 05:45
Install Authorized Keys From Github
#!/bin/bash
GITHUB_USERNAME="dongfg"
AUTHORIZED_KEYS_FILE="$HOME/.ssh/authorized_keys"
ALLOWED_KEY_TYPE="ssh-ed25519"
if [ ! -d "$HOME/.ssh" ]; then
mkdir -p "$HOME/.ssh"
chmod 700 "$HOME/.ssh"
@dongfg
dongfg / Microsoft.PowerShell_profile.ps1
Last active December 25, 2025 01:01
[PowerShell Profile] Save file to $PROFILE
function Find-Command($cmdname) {
return [bool](Get-Command -Name $cmdname -ErrorAction SilentlyContinue)
}
function Download-FileIfNotExists {
param (
[string]$LocalFilePath,
[string]$RemoteUrl
)
@dongfg
dongfg / init.gradle.kts
Last active September 26, 2025 01:22
Gradle国内全局加速, 把这个文件放到~/.gradle目录下既可, tks https://gist.github.com/wuseal/76506684c63c5399150d9fd671cbc89b
@file:Suppress("UnstableApiUsage")
object MavenMirror {
const val CENTRAL = "https://mirrors.huaweicloud.com/repository/maven/"
const val GOOGLE = "https://maven.aliyun.com/repository/google/"
const val GRADLE_PLUGIN = "https://maven.aliyun.com/repository/gradle-plugin/"
}
val mirrorMapping = listOf(
"https://repo1.maven.org/maven2" to MavenMirror.CENTRAL,
@dongfg
dongfg / run.js
Created January 23, 2024 05:36
墨刀 modao.cc 画布目录获取,打开控制台执行
function removeAttributes(node) {
if(!node.attributes) {
return;
}
for (var i = node.attributes.length - 1; i >= 0; i--) {
node.removeAttribute(node.attributes[i].name);
}
// 对于元素节点,递归处理其子节点
if (node.nodeType === Node.ELEMENT_NODE) {
for (var child of node.childNodes) {
@dongfg
dongfg / ish.sh
Last active December 29, 2025 08:30
iOS iSH init
#!/bin/sh
# ios ish setup
# wget -qO - http://10.64.60.244:9000/setup.sh | sh
# 文件/文本加密:
# echo "this is a secret." | openssl enc -e -des3 -base64 -pbkdf2 -A
# cat ~/.ssh/id_rsa_vps | openssl enc -e -des3 -base64 -pbkdf2 -A
printf "1. 更换镜像源...\n"
mirror=$(sed -e 's/https:\/\/\(.*\)\/alpine.*/\1/' /etc/apk/repositories | uniq)
newMirror="mirrors.tuna.tsinghua.edu.cn"