Skip to content

Instantly share code, notes, and snippets.

View alanhg's full-sized avatar
⌨️
Focusing

Alan.He alanhg

⌨️
Focusing
View GitHub Profile
@alanhg
alanhg / 📊 Weekly development breakdown
Last active April 19, 2024 00:03
📊 Weekly development breakdown
Bash 5 mins █████████████████████ 100.0%
@alanhg
alanhg / hide-app-app.scpt
Created January 20, 2021 14:28
hide app app
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
activate
tell application "System Events" to repeat (count windows of process a) times
@alanhg
alanhg / wifi-changed.js
Created February 6, 2021 03:55
surge wifi changed ,auto change proxy
/**
* @description
* 如果是家里WI-FI则开启直连模式
* 如果不是家里WI-FI则开启代理模式
*/
const WIFI_DONT_NEED_PROXYS = ['xiaomi_Alan_5G'];
if (WIFI_DONT_NEED_PROXYS.includes($network.wifi.ssid)) {
$surge.setOutboundMode('direct');
$notification.post('Surge', 'Wi-Fi changed', 'use direct mode');
@alanhg
alanhg / multi-screen-init.sh
Created March 2, 2021 06:02
multi-screen-init
/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"
*://www.runoob.com/*
*://zhidao.baidu.com/*
*://www.cnblogs.com/*
*://blog.csdn.net/*
@alanhg
alanhg / sound.scpt
Last active February 18, 2023 23:22
switch input or output by applescript
set devices to {}
tell application "System Preferences"
reveal pane id "com.apple.preference.sound"
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
alanhg / uBlacklist.txt
Last active November 7, 2021 01:45
垃圾站点
*://www.coder.work/*
*://blog.csdn.net/*
*://stackoom.cot/*
*://www.jb51.net/*
@alanhg
alanhg / airdrop-share.scpt
Created December 14, 2021 04:38
airdrop-share.scpt
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
-- This script brings up the AirDrop dialog for the selected file(s) in Finder (window or desktop)
-- Isaac Nelson 17 Jan 2018
-- Vastly improved by implementing Aviral Bansal's fix for UI scripting slowness: https://stackoverflow.com/a/36370637/9278116
-- Updated 28 Mar 2018 to make it work in an Automator workflow
-- Updated 17 Dec 2019 to fix issue with comparison between parentPath and desktopPath
@alanhg
alanhg / auto-review-jd.js
Created April 10, 2022 15:01
京东自动评论
/**
浏览器打开www.jd.com登录账号,按F12点击Console->复制下列代码->粘贴回车键坐等即可
*/
document.body.innerHTML = "";$("html").css("overflow","hidden");$("body").append('<div id="topTitle" style="padding:20px;display:block;font-size:48px;color:#FFFFFF;background-color:#e2231a;width:100%;text-align:center">京东自动评价JS脚本 </div><iframe src="https://club.jd.com/myJdcomments/myJdcomment.action?sort=0" style="width:99%;height:800px" id="JDifr"></iframe>');$("#J-global-toolbar").remove();let isFiveStar = true;$("#topTitle").click(function(){(isFiveStar = !isFiveStar) ? $("#topTitle").css("background-color","#e2231a"):$("#topTitle").css("background-color","#8B0000");});let pendingNum = 1;let waitSubmitIds;let curId = 0;let maxCurId = 0;$("#JDifr").load(function(){if($("#JDifr").attr("src").indexOf("sort") > 0){pendingNum = ($("#JDifr").contents().find("a.text:first").siblings().length>0 && $("#JDifr").contents().find("a.text:first").attr("href")=="?sort=0")?parseInt($("#JDifr").contents().find("a.text:first").next().text()):0;waitSubmitIds = $("#
@alanhg
alanhg / install-package-lrzsz.sh
Last active July 16, 2022 08:41
install-package-lrzsz.sh / shell
#!/bin/sh
# sudo sh -c "$(curl -fsSL https://gist.githubusercontent.com/alanhg/6a299b815f4dd3d242abc16b8be6b861/raw/dbe1497208f1d968ed8b67cad09c596e35c5be9c/install-package-lrzsz.sh)"
YUM_CMD=$(which yum)
APT_GET_CMD=$(which apt-get)
APT_CMD=$(which apt)
PACKAGE=lrzsz
if [ ! -z $YUM_CMD ]; then
yum install -y $PACKAGE