Skip to content

Instantly share code, notes, and snippets.

@willbchang
willbchang / yunshu_uninstaller.sh
Created October 13, 2023 02:44
卸载 云枢 app
sudo chflags -R noschg /Applications/Yunshu.app
sudo rm -rf /opt/yunshu \
/opt/.yunshu \
/Library/PrivilegedHelperTools/com.eagleyun.sase.helper \
/Applications/Yunshu.app
function cleanup() {
local target="$1"
@twish
twish / reset_display_montaray.md
Created November 15, 2021 15:26
Reset external displays macos monterey

Reset external display configurations in macos Monterey

Background

I had the issue where a display reported a supported resolution that was actually not supported. This caused macos to get stuck in a loop where macos would try to connect to the monitor, succeed. Only to have the monitor disconnect since it did not support the resolution. This made it impossible to manually change the resolution since macos only shows the settings if the display is connected.

After a bunch of googling and trial and error I solved it with the following workaround:

@tonybaloney
tonybaloney / app.py
Last active March 25, 2024 23:52
FastAPI with OpenTelemetry
from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from opentelemetry.context import get_current as get_current_context
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
from opentelemetry.sdk.trace import TracerProvider, _Span
from opentelemetry.sdk.trace.export import (BatchSpanProcessor,
ConsoleSpanExporter,
SimpleSpanProcessor)
from starlette.exceptions import HTTPException as StarletteHTTPException
@duskwuff
duskwuff / dictionary.bin
Last active January 23, 2025 22:42
Contents of the Brotli dictionary (JSON encoded)
"time"
"down"
"life"
"left"
"back"
"code"
"data"
"show"
"only"
"site"
@hervenivon
hervenivon / extend-apfs-container
Created January 29, 2021 11:28
A script to expand the APFS container on the boot volume with AWS EC2 Mac Instance
#!/bin/bash
PDISK=$(diskutil list physical external | head -n1 | cut -d' ' -f1)
APFSCONT=$(diskutil list physical external | grep Apple_APFS | tr -s ' ' | cut -d' ' -f8)
sudo diskutil repairDisk $PDISK
sudo diskutil apfs resizeContainer $APFSCONT 0
# https://derflounder.wordpress.com/2020/12/19/resizing-an-aws-macos-ec2-instances-boot-drive-to-use-all-available-disk-space/
@vijinho
vijinho / rclonedlna.service
Created September 20, 2020 22:19
Example rclone dlna startup service script on ubuntu/popos. place in "/etc/systemd/system/rclonedlna.service" then "systemctl daemon-reload" then "systemctl enable rclonedlna.service" and it should be up on next reboot.
[Unit]
Description=rclone dlna service
Documentation=man:rclone(1)
After=network.target auditd.service
[Service]
ExecStart=rclone serve dlna --addr :8080 \
--vfs-cache-mode full \
--vfs-cache-max-age 60m \
--vfs-cache-max-size 32768 \
@liberal-boy
liberal-boy / 代理服务器 Cake 队列规则常用参数推荐.md
Last active April 26, 2024 00:09
代理服务器 Cake 队列规则常用参数推荐

代理服务器 Cake 队列规则常用参数推荐

  • 注意,BBR 等基于延迟判断发送窗口的拥塞控制算法可能与 AQM 发生冲突!!!对于使用 BBR 的设备,fq 可能还是最好的选择。

为什么选用 Cake

Cake 使用主动队列管理(AQM)技术保持全局同步,可以控制延迟,有效利用宽带。同时它还可以保证每个主机,每个流公平的分享宽带。

使用 Cake 的条件

Cake 与 kernel 4.19 并入主线,因此使用 Cake 需要 kernel 和 iproute2 版本大于 4.19。如何确认 kernel 和 iproute2 版本,以及如何升级本文不做详细说明。

Rank Type Prefix/Suffix Length
1 Prefix my+ 2
2 Suffix +online 6
3 Prefix the+ 3
4 Suffix +web 3
5 Suffix +media 5
6 Prefix web+ 3
7 Suffix +world 5
8 Suffix +net 3
9 Prefix go+ 2
@rkttu
rkttu / kustomization.yaml
Created January 6, 2020 12:03
Deploy WordPress in K3S Cluster (based on Kubernetes Official Documentation)
secretGenerator:
- name: mysql-pass
literals:
- password=YOUR_PASSWORD_HERE
resources:
- mysql-deployment.yaml
- wordpress-deployment.yaml