Skip to content

Instantly share code, notes, and snippets.


Alan.He alanhg

View GitHub Profile
View hide-app-app.scpt
tell application "System Events" to set all_apps to the name of every process whose visible is true
repeat with a in all_apps
tell application a to try
repeat with w in (get every window)
set miniaturized of w to true
end repeat
on error
tell application "System Events" to repeat (count windows of process a) times
alanhg / wifi-changed.js
Created Feb 6, 2021
surge wifi changed ,auto change proxy
View wifi-changed.js
* @description
* 如果是家里WI-FI则开启直连模式
* 如果不是家里WI-FI则开启代理模式
const WIFI_DONT_NEED_PROXYS = ['xiaomi_Alan_5G'];
if (WIFI_DONT_NEED_PROXYS.includes($network.wifi.ssid)) {
$'Surge', 'Wi-Fi changed', 'use direct mode');
/usr/local/bin/displayplacer "id:FD965078-20C5-7F8A-3AE7-A0FE6C33C5C6 res:2560x1440 hz:60 color_depth:8 scaling:off origin:(0,0) degree:0" "id:EBE8E036-2C6E-9026-BEA4-F0D3A3F2DE71 res:1440x2560 hz:59 color_depth:8 scaling:off origin:(-1440,-1081) degree:90"
View gist:7edcefcfa714d2f74880df05af1a06e5
alanhg / sound.scpt
Last active Apr 10, 2021
switch input or output by applescript
View sound.scpt
set devices to {}
tell application "System Preferences"
reveal pane id ""
end tell
tell application "System Events"
tell application process "System Preferences"
tell tab group 1 of window "Sound"
click radio button "Output"
tell table 1 of scroll area 1
alanhg / 📊 Weekly development breakdown
Last active May 20, 2021
📊 Weekly development breakdown
View 📊 Weekly development breakdown
JavaScript 3 hrs 56 mins ██████████████████░░░ 86.0%
HTML 29 mins ██▎░░░░░░░░░░░░░░░░░░ 10.9%
JSON 6 mins ▍░░░░░░░░░░░░░░░░░░░░ 2.2%
Text 2 mins ▏░░░░░░░░░░░░░░░░░░░░ 0.9%