This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "html/template" | |
| "log" | |
| "net/http" | |
| "time" | |
| ) | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // temp solution to run browserify with watch | |
| package main | |
| import ( | |
| "flag" | |
| "log" | |
| "os" | |
| "os/exec" | |
| "strings" | |
| "time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // fetch images concurrently with set limits equal to cl | |
| func fetchImages(imgs Images, cl int, put, del chan<- Img, w *sync.WaitGroup) { | |
| log.Printf("Total images to fetch %+v\n", len(imgs.List)) | |
| // loop through all images and retrive them concurrently | |
| for i := 0; i < len(imgs.List); { | |
| w.Add(cl) | |
| for ii := 0; ii < cl; ii++ { | |
| img := imgs.List[i+ii] | |
| go getImg(img, imgs.GetImgName(i+ii), put, del, w) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //write pid into file | |
| f, err := os.Create("/var/run/go-ws-daemon.pid") | |
| if err != nil { | |
| panic(err) | |
| } | |
| pid := os.Getpid() | |
| b := []byte(strconv.Itoa(pid)) | |
| _, err = f.Write([]byte(b)) | |
| if err != nil { | |
| panic(err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: skeleton | |
| # Required-Start: $remote_fs $syslog | |
| # Required-Stop: $remote_fs $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Example initscript | |
| # Description: This file should be used to construct scripts to be | |
| # placed in /etc/init.d. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func main() { | |
| // private token for authentications | |
| token := "5p94RchB-9pXWRE71Hv2" | |
| ts := Issue{} | |
| ts.PID = "root%2Fhrkb" | |
| ts.Title = "Auto Issue" | |
| ts.Desc = "Description should be added" | |
| ts.Labels = "UI" | |
| // url of gitlab issues | |
| url := "http://office.newmax.uz:7775/api/v3/projects/" + ts.PID + "/issues" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "bufio" | |
| "encoding/csv" | |
| "encoding/json" | |
| "fmt" | |
| "io" | |
| "os" | |
| "path/filepath" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| // Example explaining how slices works | |
| // About slice's capacity, pointers and copies | |
| import "fmt" | |
| func main() { | |
| // let's create slice with len 2 and capacity 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "time" | |
| ) | |
| // handlerFuncs sayHello for http://localhost:4000/hello url |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "log" | |
| "os" | |
| "strings" | |
| ) |