Skip to content

Instantly share code, notes, and snippets.

View scbizu's full-sized avatar
🤗
用代码给大家带来笑容 Bring smiles with codes

Nace Sc scbizu

🤗
用代码给大家带来笑容 Bring smiles with codes
View GitHub Profile
@scbizu
scbizu / sort_go.go
Last active May 26, 2016 16:44
Go Basic Sort
package main
import (
"fmt"
"time"
)
//bubbleSort
func bubbleSort(origin []int) []int {
count := len(origin) - 1
@scbizu
scbizu / file_mv.go
Created May 28, 2016 12:09
[LINUX/OSX ENV]golang put file in a dir
package main
import (
"fmt"
"os/exec"
)
func main() {
MVcmd := exec.Command("mv", "Ncell.png", "test")
err := MVcmd.Run()
@scbizu
scbizu / Multi_thread.go
Created May 30, 2016 10:40
an example for how to make mutil-thread code with Golang
package main
import "fmt"
/*
*Question:
*使用Channel堵塞主线程 等待Gor GO完
*/
var chan1 chan int = make(chan int)
@scbizu
scbizu / Maxprocs.go
Created May 30, 2016 11:20
Test golang Maxprocs
package main
import (
"fmt"
// "runtime"
)
/*
*Question:
*Test GOMAXPROCS
@scbizu
scbizu / oop_method.go
Created May 30, 2016 16:50
golang oop practice(method and some oop features)
package main
import "fmt"
type human struct {
age int
name string
}
//继承
@scbizu
scbizu / stack.go
Created May 31, 2016 03:40
LIFO stack golang
//Stack Golang
package main
import "fmt"
type Element struct {
next *Element
val interface{}
}
@scbizu
scbizu / closure_OFP.go
Created June 6, 2016 06:46
函数编程思维的闭包例子的Golang实现
package main
import "fmt"
type Studnet struct {
name string
age int
}
func Average(age int) func(stu *Studnet) bool {
@scbizu
scbizu / json_format.go
Created August 1, 2016 16:42
struct to json
package main
import (
"encoding/json"
"fmt"
)
type JsonFor struct {
Foo string `json:"foo"`
Foo_s string `json:"foo_s,string"`
@scbizu
scbizu / jparse.go
Created August 19, 2016 17:53
golang json.Indent() 的一种实现
package jparse
import (
"bytes"
"encoding/json"
)
func newline(dst *bytes.Buffer, depth int) {
dst.WriteByte('\n')
@scbizu
scbizu / testlepton.go
Created February 6, 2017 03:38
[test]Lepton Test #tags:Lepton,golang
package main
import (
"fmt"
)
func main(){
fmt.Println("Hello Lepton")
}