Created
January 27, 2017 09:13
-
-
Save PierreZ/22fd7a349e96710c13cb6f6b91883616 to your computer and use it in GitHub Desktop.
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 ( | |
"bytes" | |
"encoding/base64" | |
"encoding/csv" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"strings" | |
) | |
func main() { | |
body, err := ioutil.ReadFile("/home/pierre/Downloads/badges.csv") | |
r := csv.NewReader(bytes.NewReader(body)) | |
warpscript := "{ " | |
records, err := r.ReadAll() | |
if err != nil { | |
log.Fatal(err) | |
} | |
for i, line := range records { | |
if i == 0 { | |
continue | |
} | |
//fmt.Println(i, line) | |
if len(line[5]) != 0 { | |
warpscript = warpscript + ` '` + base64.StdEncoding.EncodeToString([]byte(line[4])) + `' '` + strings.Replace(line[1]+" "+line[0], "'", "", -1) + `'` | |
} | |
} | |
warpscript = warpscript + ` } 'users' STORE` | |
fmt.Println(warpscript) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment