Skip to content

Instantly share code, notes, and snippets.

View alexmaze's full-sized avatar
🍼

Alex Yan alexmaze

🍼
  • Tencent
  • Shanghai, China
View GitHub Profile
@alexmaze
alexmaze / UnitConvertUtil.ts
Last active April 14, 2017 01:53
单位转换
export class UnitConvertUtil {
/**
* 文件大小 例如 1024 -> 1 MB
*
* @param {*} value
* @param {number} fix
* @param {string} [base]
* @returns
*
@alexmaze
alexmaze / SearchObj.ts
Created April 14, 2017 03:06
search object contents
function search(obj: Object, query: string) {
for (let key of Object.getOwnPropertyNames(obj)) {
if (RegExp(query, 'i').test(obj[key])) {
return true
}
}
return false
}
@alexmaze
alexmaze / global-protect.sh
Created August 24, 2017 02:10 — forked from kaleksandrov/global-protect.sh
Simple script that starts and stops GlobalProtect.app on Mac OSX.
#!/bin/bash
case $# in
0)
echo "Usage: $0 {start|stop}"
exit 1
;;
1)
case $1 in
start)
@alexmaze
alexmaze / subnet.go
Created February 11, 2018 08:59
根据现有网段,计算一个与现有网段均不冲突的网段
package utils
import (
"bytes"
"encoding/binary"
"fmt"
"net"
"sort"
"strconv"
@alexmaze
alexmaze / My Windows Shutcuts
Last active June 26, 2018 09:17
AutoHotkey
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Key Mappings
LCtrl::RCtrl
CapsLock::LCtrl
LAlt::LWin
LWin::LAlt
RAlt::~
RCtrl::CapsLock
-- 重新加载配置
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "R", function()
hs.reload()
end)
hs.alert.show("加载完毕")
-- 窗口横二竖二
hs.hotkey.bind({"cmd", "ctrl"}, "a", function()
local win = hs.window.focusedWindow()