Skip to content

Instantly share code, notes, and snippets.


Alan.He alanhg

View GitHub Profile
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
View gist:7edcefcfa714d2f74880df05af1a06e5
/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"
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');
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 / 📊 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%
#!/usr/bin/env bash
# Extract the host where the server is running, and add the URL to the APIs
[[ $HOST =~ ^https?://[^/]+ ]] && HOST="${BASH_REMATCH[0]}/api/v4/projects/"
# The description of our new MR, we want to remove the branch after the MR has
# been closed
\"id\": ${CI_PROJECT_ID},
\"source_branch\": \"${CI_COMMIT_REF_NAME}\",
\"target_branch\": \"${TARGET_BRANCH}\",
alanhg / karabiner.json
Last active Aug 1, 2020
Filco 87配合Mac改键设置
View karabiner.json
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
"profiles": [
"complex_modifications": {
"parameters": {
alanhg /
Last active Mar 15, 2020
checkstyle when pre commit
function print(){
echo "===========$*============"
print "Start check style for Java"
View axios-utils.ts
import axios from 'axios';
* Cancel previous pending request
const pending = new Map();
export const addPending = config => {
const url = [config.method, config.url].join('&');
config.cancelToken =