Last active
December 29, 2015 06:09
-
-
Save austa/7627465 to your computer and use it in GitHub Desktop.
This file contains 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" | |
"github.com/ActiveState/golor" | |
"math/rand" | |
"os" | |
"strconv" | |
"time" | |
) | |
type PassCard struct { | |
karakter string | |
cardId int64 | |
semboller string | |
} | |
func (p *PassCard) argumanVarMi() { | |
if len(os.Args) == 1 { | |
p.cardId = time.Now().UnixNano() | |
} else { | |
p.cardId, _ = strconv.ParseInt(os.Args[1], 16, 64) | |
} | |
} | |
func (p *PassCard) sembolVarMi() string { | |
var cevap string | |
fmt.Println("Sifreniz sembol icersin mi? (e/h)") | |
fmt.Scanf("%s", &cevap) | |
if cevap == "e" { | |
p.karakter = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ@$#%&<>?+{}[]()/\\" | |
} else { | |
p.karakter = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNPOQPRSTUVWXYZ" | |
} | |
return p.karakter | |
} | |
func (p *PassCard) renkliSifreUret() { | |
p.semboller = "\n ■□▲△○●★☂☀☁☹☺♠♣♥♦♫€¥£$!?¡¿⊙◐◩�" | |
fmt.Println(p.semboller) | |
rand.Seed(p.cardId) | |
for j := 0; j < 8; j++ { | |
bosString := "" | |
for i := 0; i < 29; i++ { | |
index := rand.Intn(len(p.karakter)) | |
bosString += p.karakter[index : 1+index] | |
} | |
fmt.Print(j + 1) | |
fmt.Print(" ") | |
fmt.Println(golor.Colorize(bosString, golor.AssignColor(bosString), -1)) | |
} | |
} | |
func (p *PassCard) kartNo() { | |
fmt.Println("Kart no: ", strconv.FormatInt(p.cardId, 16)) | |
} | |
func main() { | |
var p PassCard | |
p.argumanVarMi() | |
p.sembolVarMi() | |
p.renkliSifreUret() | |
p.kartNo() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment