把这两个函数定义放入~/.profile
function tmc() {
for d in $(mount |grep Time|awk '{print $3}'); do
diskutil umount "$d HD";
done
package main | |
import ( | |
"flag" | |
"io" | |
"log" | |
"net" | |
"net/http" | |
"os" | |
"strings" |
package main | |
import ( | |
"flag" | |
"log" | |
"net" | |
"net/http" | |
) | |
var addr = flag.String("l", ":8000", "Listening address") |
function tmc() { | |
before=$(df -hl / |awk '{print $3}' |tail -n1) | |
count=0 | |
for snapshot in $(tmutil listlocalsnapshots /|awk -F. '{print $4}');do | |
let 'count++' | |
echo "delete snapshot $snapshot" | |
tmutil deletelocalsnapshots $snapshot; | |
done | |
after=$(df -hl / |awk '{print $3}' |tail -n1) | |
if [[ $count -ne 0 ]]; then |
#!/usr/bin/env bash | |
# 1. what is image retentiion: https://support.apple.com/en-us/HT202580 | |
# 2. Put this file ~/.local/bin/ | |
# 3. then Add this to crontab | |
# */10 * * * * ~/.local/bin/switch-darkmode.sh | |
osascript -e ' | |
tell application id "com.apple.systemevents" | |
tell appearance preferences |
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/jackpal/gateway" | |
natpmp "github.com/jackpal/go-nat-pmp" | |
) |
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"net/url" | |
"regexp" | |
"strings" | |
) |
#!/usr/bin/env bash | |
USERNAME= #改成你的读者卡号 | |
PASSWORD= #改成你的读者卡密码 | |
LOGINURL="http://192.168.180.11:8080/nlcwlan/QueryGuest" | |
PASSWORD=$(echo $PASSWORD|base64) | |
UA="Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)" |
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |