Skip to content

Instantly share code, notes, and snippets.

View FradSer's full-sized avatar
🎯
Focusing

Frad LEE FradSer

🎯
Focusing
View GitHub Profile
@FradSer
FradSer / SketchSystems.spec
Last active July 9, 2020 07:42
Nippon Colors Game
Nippon Colors Game
is color hited -> Color Display
Color Mixer
Color Display
is color changed -> Color Mixer
# Usage: gifify foobar [--good]
gifify () {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 1200x1200\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -vf scale=1200:-1 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
@State var timeCount: Double = 0.0
var timer: Timer {
Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) {timer in
self.timeCount += 0.1
}
}
Text(timeString(time: timeCount))
.onAppear(perform: {
let _ = self.timer
})
func timeString(time: Double) -> String {
return String(format: "%.1f", time)
}
#!/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 -"
// 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

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:

@FradSer
FradSer / surge.sh
Created March 11, 2016 04:22
Surge for Mac 的相关 function,实现快速添加规则,快速配置适合 Surge for Mac 的网络配置,以及还原网络配置。
# 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 \
# 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 \