Skip to content

Instantly share code, notes, and snippets.

View flydo's full-sized avatar
💭
I may be slow to respond.

扉度 flydo

💭
I may be slow to respond.
View GitHub Profile
@flydo
flydo / get_latest_release.sh
Created September 25, 2021 08:45 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@flydo
flydo / copy.go
Created July 8, 2019 02:21 — forked from r0l1/copy.go
Copy a directory tree (preserving permissions) in Go.
/* MIT License
*
* Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@flydo
flydo / gbkbig5.go
Created May 21, 2019 06:28 — forked from zhang0098/gbkbig5.go
Golang GBK Big5 from/to UTF-8 转换
import (
"bytes"
"io/ioutil"
"golang.org/x/text/encoding/traditionalchinese"
"golang.org/x/text/encoding/simplifiedchinese"
"golang.org/x/text/transform"
)
//convert GBK to UTF-8
func Decodegbk(s []byte) ([]byte, error) {
I := bytes.NewReader(s)