Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Frad LEE FradSer

🎯
Focusing
View GitHub Profile
@FradSer
FradSer / Update Sketch Plugins
Last active Aug 26, 2015
Update Sketch Plugins
View Update Sketch Plugins
alias updatesketch='find $HOME/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application\ Support/com.bohemiancoding.sketch3/Plugins/ -name ".git" -exec git --git-dir={} pull ";"'
View compress.sh
# Compress image with TinyJPG
function compress() {
if [ -n "${TinyJPG_API}" ]; then
for image in $*; do
local url=$(curl -i --user api:$TinyJPG_API --data-binary @"$image" https://api.tinify.com/shrink | grep Location: | awk '{split($0,a,": ");print a[2]}' | tr -d '\r');
wget $url -O "$image";
done
else
echo "TinyJPG_API is not defined! Please defined TinyJPG_API in ~/.path"
fi
View .surge.conf
# Surge for Mac 配置文件
# 显示 Finder 隐藏文件,将 .surge.conf 文件复制到 ~/ 也就是「个人」目录下。
[General]
# warning, notify, info, verbose
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local
bypass-tun = 0.0.0.0/8, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10
loglevel = notify
# 默认 IP 和端口,不修改的话系统网络 HTTP 和 HTTPS 代理设置中就是 127.0.0.1:6152
View surge_add.sh
# Surge for Mac
function surge_add() {
if [ "$1" == "--proxy" -o "$1" == "-p" -o "$1" == "--direct" -o "$1" == "-d" ]; then
if [ "$(cat ~/.surge.conf | grep -c $2)" -eq 0 ]; then
if [ "$1" == "--proxy" -o "$1" == "-p" ]; then
sed -i '' -e '541i \
DOMAIN-SUFFIX,'$2',Proxy' ~/.surge.conf;
fi;
if [ "$1" == "--direct" -o "$1" == "-d" ]; then
sed -i '' -e '541i \
@FradSer
FradSer / surge.sh
Created Mar 11, 2016
Surge for Mac 的相关 function,实现快速添加规则,快速配置适合 Surge for Mac 的网络配置,以及还原网络配置。
View surge.sh
# Surge for Mac. Portnumber is 6152.
function surge_add() {
if [ "$1" == "--proxy" -o "$1" == "-p" -o "$1" == "--direct" -o "$1" == "-d" ]; then
if [ "$(cat ~/.surge.conf | grep -c $2)" -eq 0 ]; then
if [ "$1" == "--proxy" -o "$1" == "-p" ]; then
sed -i '' -e '539i \
DOMAIN-SUFFIX,'$2',Proxy' ~/.surge.conf;
fi;
if [ "$1" == "--direct" -o "$1" == "-d" ]; then
sed -i '' -e '539i \
View keybase.md

Keybase proof

I hereby claim:

  • I am FradSer on github.
  • I am fradser (https://keybase.io/fradser) on keybase.
  • I have a public key whose fingerprint is 4420 5D82 FDD0 B496 4632 83A5 EC90 3317 4BAB AF4A

To claim this, I am signing this object:

View .hyper.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 14,
// font family with optional fallbacks
View .aliases.backup
#!/usr/bin/env bash
# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ~="cd ~" # `cd` is probably faster to type though
alias -- -="cd -"
View .aliases
# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ~="cd ~" # `cd` is probably faster to type though
alias -- -="cd -"
# Shortcuts
alias db="cd ~/Dropbox"
View SwiftUI Challenge - C01B02.swift
func timeString(time: Double) -> String {
return String(format: "%.1f", time)
}