Skip to content

Commit

Permalink
(broken git) reinit the project
Browse files Browse the repository at this point in the history
  • Loading branch information
jozn committed Jan 25, 2018
0 parents commit 6c658d5
Show file tree
Hide file tree
Showing 297 changed files with 164,866 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
tmp/
bower_components/
dist/
/.bundle
#/platforms

.bundle/
bundle
bin/
/node_modules

../.idea/
.idea/

.module-cache
*.module-cache/*
src/tmp/

upload/

ws_*

*.map
*.exe
*.exe~
*.exe;
**.exe
play/img/*
play/**/*.jpg
play/**/*.jpeg
play/**/*.png
play/**/*.zip
play/**/*.exe
play/**/*.svg
public/
/public/
/upload
*.exe
*.exe~
/.idea
*.sublime-*
log*
logs/

*.out
graphs/

!/scripts/protoc-gen-grpc-java-1.3.0-windows-x86_64.exe
!/scripts/protoc-gen-grpc-java-1.4.0-windows-x86_64.exe
projectFilesBackup/
/build/
torch*
24 changes: 24 additions & 0 deletions other/play/hash/murm3.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

import (
"github.com/spaolacci/murmur3"
"fmt"
"ms/sun/helper"
"log"
)
func main() {
//mp := make(map[string]int)
mp := make(map[int]string)

for i:=0; i< 1000000 ; i++ {
s := fmt.Sprintf("%d_liked_%d", helper.NextRowsSeqId(), helper.NextRowsSeqId())
i:=int(murmur3.Sum64([]byte(s)))
v,ok := mp[i]
if ok {
log.Panic(v, s, i)
}
mp[i] = s
//fmt.Println(i)
}

}
43 changes: 43 additions & 0 deletions scripts/gen_pb.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package main

import (
"fmt"
"os"
"os/exec"
"strings"
)

//Note don't use "" to wrap commands in args string it dosn't work, just plain text

//see java-grpc : https://github.com/grpc/grpc-java/tree/master/compiler

func main() {
fmt.Println(os.Getwd())
os.Chdir("../shared/proto/")
fmt.Println(os.Getwd())

cd := []string{
`ants.exe -alaki`,
`protoc --go_out=plugins=grpc:../x -I ./ *.proto`,
// `protoc --java_out=D:\dev_working2\MS_Native\app\src\main\java --grpc-java_out=D:\dev_working2\MS_Native\app\src\main\java *.proto`,
// `protoc --plugin=protoc-gen-grpc-java=C:\Go\_gopath\src\ms\sun\scripts\protoc-gen-grpc-java-1.4.0-windows-x86_64.exe --java_out=D:\dev_working2\MS_Native\proto\src\main\java --grpc-java_out=lite:D:\dev_working2\MS_Native\proto\src\main\java *.proto`,
`protoc --plugin=protoc-gen-grpc-java=C:\Go\_gopath\src\ms\sun2\scripts\protoc-gen-grpc-java-1.4.0-windows-x86_64.exe --java_out=D:\ms\social\proto\src\main\java --grpc-java_out=lite:D:\ms\social\proto\src\main\java *.proto`,
// `protoc --grpc-java_out=lite:=D:\dev_working2\MS_Native\app\src\main\java --grpc-java_out=D:\dev_working2\MS_Native\app\src\main\java *.proto`,//java jsut grpc
`goimports -w ../x/`,
`javafmt -alaki`,
}

for _, c := range cd {
args := strings.Split(c, " ")
fmt.Println(strings.Join(args, " * "))
cmd := exec.Command(args[0], args[1:]...)
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
err := cmd.Run()
if err != nil {
fmt.Errorf("Error: %s", err)
}
}

}
28 changes: 28 additions & 0 deletions scripts/gen_snake.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"fmt"
"os"
"os/exec"
"strings"
)

//Note don't use "" to wrap commands in args string it dosn't work, just plain text
func main() {

//cmd := exec.Command(`xox mysql://root:123456@localhost:3307/ms -o "../models/x" --package x --template-path C:\Go\_gopath\src\ms\xox\templates`)
//args := []string{"xox", "mysql://root:123456@localhost:3307/ms" , "-o", "../models/x" , "--package"}
args := strings.Split(`mysql://root:123456@localhost:3306/ms -o ../shared/x --package x --template-path C:\Go\_gopath\src\ms\xox\templates`, " ")
fmt.Println("")
fmt.Println(strings.Join(args, " * "))
// cmd := exec.Command(`xox`, args...)
cmd := exec.Command(`snake`, args...)
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
err := cmd.Run()
if err != nil {
fmt.Errorf("Error: %s", err)
}

}
28 changes: 28 additions & 0 deletions scripts/gen_xox.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"fmt"
"os"
"os/exec"
"strings"
)

//Note don't use "" to wrap commands in args string it dosn't work, just plain text
func main() {

//cmd := exec.Command(`xox mysql://root:123456@localhost:3307/ms -o "../models/x" --package x --template-path C:\Go\_gopath\src\ms\xox\templates`)
//args := []string{"xox", "mysql://root:123456@localhost:3307/ms" , "-o", "../models/x" , "--package"}
args := strings.Split(`mysql://root:123456@localhost:3306/ms -o ../models/x --package x --template-path C:\Go\_gopath\src\ms\xox\templates`, " ")
fmt.Println("")
fmt.Println(strings.Join(args, " * "))
cmd := exec.Command(`xox`, args...)
// cmd := exec.Command(`snake`, args...)
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
err := cmd.Run()
if err != nil {
fmt.Errorf("Error: %s", err)
}

}
Binary file added scripts/google-java-format-1.3-all-deps.jar
Binary file not shown.
33 changes: 33 additions & 0 deletions scripts/javafmt/javafmt.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package main

import (
"fmt"
"os"
"os/exec"
"strings"
)

func main() {
fmt.Println(os.Getwd())
os.Chdir(`C:\Go\_gopath\src\ms\sun2\scripts`)
fmt.Println(os.Getwd())

cd := []string{
`java -jar ./google-java-format-1.3-all-deps.jar -r D:\ms\social\app\src\main\java\ir\ms\pb\* `,
`java -jar ./google-java-format-1.3-all-deps.jar -r D:\ms\social\app\src\main\java\com\mardomsara\* `,
}

for _, c := range cd {
args := strings.Split(c, " ")
fmt.Println(strings.Join(args, " * "))
cmd := exec.Command(args[0], args[1:]...)
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
err := cmd.Run()
if err != nil {
fmt.Errorf("Error: %s", err)
}
}

}
35 changes: 35 additions & 0 deletions scripts/linux_gen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package main

import (
"fmt"
"os"
"os/exec"
"strings"
)

//Note don't use "" to wrap commands in args string it dosn't work, just plain text
func main() {
fmt.Println(os.Getwd())
os.Chdir("../")
fmt.Println(os.Getwd())

cd := []string{
`set GOOS=linux`,
`go install`,
`go build -o ./build/sun_linux main.go`,
}

for _, c := range cd {
args := strings.Split(c, " ")
fmt.Println(strings.Join(args, " * "))
cmd := exec.Command(args[0], args[1:]...)
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
err := cmd.Run()
if err != nil {
fmt.Errorf("Error: %s", err)
}
}

}
12 changes: 12 additions & 0 deletions scripts/linux_gen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
echo "*******************"
echo "Builiding for linux"
echo "*******************"

cd ../
pwd
export GOOS=linux
#set GOOS=linux # in command manuly do this - in bash scripts use above export
go env
go install
go build -o ./build/sun_linux
122 changes: 122 additions & 0 deletions scripts/loc2/loc2.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package main

import (
"bytes"
"fmt"
"github.com/hacdias/fileutils"
"github.com/jozn/go-jalali/jalali"
"io/ioutil"
"ms/sun/helper"
"os"
"os/exec"
"path"
"time"
)

const SUN_DIR = `C:\Go\_gopath\src\ms\sun2\`
const TMP_DIR = SUN_DIR + "scripts/tmp/"
const SCRIPTS_DIR = SUN_DIR + "scripts/"
const ANDROID_APP_DIR = `D:\ms\social\app\src\main\java\com\mardomsara\`
const ANDROID_SOCIAL_DIR = `D:\ms\social\app\src\main\java\com\mardomsara\social`
const ANTS_DIR = `C:\Go\_gopath\src\ms\ants`

func main() {
bts := bytes.NewBufferString("")

copypDirsForSun()

bts.WriteString(header("Sun"))

cmd := exec.Command("cloc.exe", SCRIPTS_DIR)
//cmd.Stdout = os.Stdout
cmd.Stdout = bts
cmd.Run()

bts.WriteString(header("End Sun"))
cleanTemp()

bts.WriteString("\n\n\n")
///////////////// Android /////////////////////
bts.WriteString(header("Android"))

cmd = exec.Command("cloc.exe", ANDROID_APP_DIR)
cmd.Stdout = bts
cmd.Run()
bts.WriteString(header("End Android"))
bts.WriteString("\n\n\n")
////////////////// End Android //////////////////

///////////////// Android Social /////////////////////
bts.WriteString(header("Android Social"))
cmd = exec.Command("cloc.exe", ANDROID_SOCIAL_DIR)
cmd.Stdout = bts
cmd.Run()
bts.WriteString(header("End Android Social"))
bts.WriteString("\n\n\n")
////////////////// End Android Social //////////////////

///////////////// Android Social /////////////////////
bts.WriteString(header("Ants"))
cmd = exec.Command("cloc.exe", ANTS_DIR)
cmd.Stdout = bts
cmd.Run()
bts.WriteString(header("End Ants"))
bts.WriteString("\n\n\n")
////////////////// End Android Social //////////////////

fmt.Println(bts.String())

year, mont, day := jalali.Gtoj(time.Now())
f, err := os.Create(path.Join(SCRIPTS_DIR, fmt.Sprintf("/loc_log/sun_%d__%d-%d-%d.txt", calDayChangeFrom826(), year, mont, day)))
helper.NoErr(err)
f.WriteString(bts.String())
}

func calDayChangeFrom826() int {
t, err := time.Parse(time.RFC822Z, "20 Aug 17 00:00 +0330")
helper.NoErr(err)
startDay := 826
now := time.Now()
diff := now.Sub(t)
fmt.Println("Days diff:", diff.Seconds()/86400)
dayShift := diff.Seconds() / 86400
startDay += int(dayShift)

return startDay
}

func copypDirsForSun() {
dirs := []string{"models", "ctrl", "helper", "base"}

os.RemoveAll(TMP_DIR)
os.Mkdir(TMP_DIR, os.ModeDir)

for _, dir := range dirs {
fileutils.CopyDir(SUN_DIR+dir, TMP_DIR+dir)
}

//cleanSubDirs(TMP_DIR + "models")
os.RemoveAll(TMP_DIR + "models/x")
}

func cleanTemp() {
os.RemoveAll(TMP_DIR)
}

func cleanSubDirs(folder string) {

fs, err := ioutil.ReadDir(folder)
helper.NoErr(err)

for _, f := range fs {
if f.IsDir() {
//os.Remove(path.Join(folder + "/" + f.Name()))
fmt.Println(path.Join(folder + "/" + f.Name()))
}
}
}

func header(h string) string {
s := "==================================="
return "" + s + " " + h + " " + s + "\n"
}
Loading

0 comments on commit 6c658d5

Please sign in to comment.