Skip to content

Instantly share code, notes, and snippets.

🔥
On Fire

Bo-Yi Wu appleboy

🔥
On Fire
Block or report user

Report or block appleboy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@appleboy
appleboy / golang.md
Last active Jul 2, 2019
Go 語言基礎課程
View golang.md

Go 語言開發實戰從入門到進階

課程說明

Go 語言 (又稱 Golang) 是 Google 推出新一代的強大語言,2019 年 3 月 Google 公佈了去年底統計的問卷結果,發現 65% 用 Go 來寫網站,39% 用來開發系統程式,41% 用來做 DevOps (多重選擇),可想而知 Go 語言可以拿來從底層寫到上層。高效能的 Goroutine (併發) 表現優於 Parallelism (並行),語法上簡潔又簡單,這也就是為什麼我們要來嘗試 Go 語言。

Go 語言入門

  • Go 語言開發環境
    • VSCode 環境介紹 (Go 語言相關設定及技巧)
@appleboy
appleboy / jwt.go
Created Jun 1, 2018
jwt decode example
View jwt.go
package main
import (
"log"
"gopkg.in/dgrijalva/jwt-go.v3"
)
func main() {
t := "eyJ0eXAiOiJKV1QiLCJraWQiOiIwNDYzOGI1ZS1iZDI5LTQzYzAtOGE5ZS02OGZjYmE2NWJiNDEiLCJhbGciOiJIUzI1NiIsImlzcyI6Imh0dHBzOi8vYWNjb3VudHMuZ29vZ2xlLmNvbSIsImNsaWVudCI6IjIzMzE4NzM3MTY3NS1xN25vYjZldWRsazliMmM4ZGlxMm4wZ2IxaDI5cWsxai5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbSIsInNpZ25lciI6ImFybjphd3M6ZWxhc3RpY2xvYWRiYWxhbmNpbmc6dXMtZWFzdC0xOjkwMzc3OTQ0ODQyNjpsb2FkYmFsYW5jZXIvYXBwL2RlZmF1bHQvYTQ1MDkxNGRjZTM1ZjA1OCIsImV4cCI6MTUyNzgxNzI1MX0.eyJzdWIiOiIxMTA5Nzc1OTIyMTU4NzcwMzU5ODciLCJuYW1lIjoiQm8tWWkgV3UiLCJnaXZlbl9uYW1lIjoiQm8tWWkiLCJmYW1pbHlfbmFtZSI6Ild1IiwicHJvZmlsZSI6Imh0dHBzOi8vcGx1cy5nb29nbGUuY29tLzExMDk3NzU5MjIxNTg3NzAzNTk4NyIsInBpY3R1cmUiOiJodHRwczovL2xoNC5nb29nbGV1c2VyY29udGVudC5jb20vLW42SW81d0Q5SWFZL0FBQUFBQUFBQUFJL0FBQUFBQUFBUjh3Ly1OYmN1RVM5cXJrL3Bob3RvLmpwZyIsImdlbmRlciI6Im1hbGUifQ.8Zpgf6pEt3RPRdT_l-3PyTBpDwNRu6E6NyIXZMRXQOc"
View car_test.go
package car
import (
"testing"
"github.com/stretchr/testify/assert"
)
// Simple testing what different between Fatal and Error
func TestNew(t *testing.T) {
@appleboy
appleboy / minio.go
Last active Jan 25, 2018
minio sdk with AWS iam Role
View minio.go
package main
import (
"log"
"github.com/minio/minio-go"
"github.com/minio/minio-go/pkg/credentials"
)
func main() {
@appleboy
appleboy / docker.md
Created Nov 15, 2017
Docker 容器技術教學營
View docker.md

課程簡介

[Docker][2] 是一個開源專案,原始碼放在 [GitHub][1] 上面做維護,支援多平台,從筆電到公、私有雲上能進行快速部署輕量、獨立的作業環境。 Docker 使用 Linux 核心中的功能,Namespace 及 Control Groups (cgroups) 等,來達到建置獨立的環境及控制 CPU 、Memory 、網路等資源。 為什麼要使用 Docker 技術?Docker 帶給我們在工作環境上有什麼樣的優勢:

  1. 更快速的交付和部署
  2. 更有效率的虛擬化
  3. 更輕鬆的遷移和擴展
  4. 更簡單的管理
@appleboy
appleboy / docker-compose.bitbucket.yml
Created Nov 11, 2017
Drone with bitbucket config
View docker-compose.bitbucket.yml
version: '2'
services:
drone-server:
image: drone/drone:0.8
ports:
- 8080:8000
- 9000:9000
volumes:
- ./:/var/lib/drone/
@appleboy
appleboy / requirement.md
Last active Nov 10, 2017
Drone 事前準備
View requirement.md

Drone 事前準備

請使用 Linux 或 MacOS 來進行 Drone 實戰,如果你是使用 Windows 環境,請務必裝好 VM 或者是使用 Digital Ocean 機器。Do 機器可以使用小時計費 可以選用最小方案 $20/month,每小時大約 0.03 美金。請務必先安裝底下兩項軟體:

View user_passwor.go
package main
import (
"fmt"
"log"
"golang.org/x/crypto/bcrypt"
)
func main() {
@appleboy
appleboy / .drone.yml
Created Oct 8, 2017
drone scp config example.
View .drone.yml
scp_dev:
image: appleboy/drone-scp
pull: true
host: example.com
port: 22
username: deploy
target: /home/deploy/drone/${DRONE_REPO}
secrets:
- source: deploy_key
target: scp_key
@appleboy
appleboy / deploy.yml
Created Jul 31, 2017
drone server + agent for docker swarm
View deploy.yml
version: "3"
networks:
traefik:
external: true
internal:
internal: true
volumes:
minio:
You can’t perform that action at this time.