text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func DumpAllStacks(out io.Writer) {
size := 1024 * 8
for {
buf := make([]byte, size)
if len := runtime.Stack(buf, true); len <= size {
out.Write(buf[:len])
return
}
size = size + (1024 * 8)
}
} | [
1.2756309509277344,
0.8240700364112854,
0.7334479689598083,
0.7330523133277893,
0.24183568358421326,
-0.43745917081832886,
0.6203537583351135,
-0.9671820402145386,
0.13578514754772186,
-0.345052033662796,
-0.5684794187545776,
-0.37827855348587036,
-0.49805641174316406,
1.7921150922775269,
... |
func (r *Resolver) Mutation() gql.MutationResolver { return &mutationResolver{r} } | [
-0.3774470388889313,
-0.44762998819351196,
0.14464321732521057,
0.37581557035446167,
0.17377059161663055,
-0.03316967189311981,
0.23554547131061554,
-0.22602041065692902,
0.9695373773574829,
-0.7030394673347473,
-0.15102618932724,
-1.1474809646606445,
0.2402230054140091,
-0.176438897848129... |
func ProcessXOR(data []byte, key []byte) []byte {
out := make([]byte, len(data))
for i := range data {
out[i] = data[i] ^ key[i%len(key)]
}
return out
} | [
-0.24250097572803497,
0.1182507872581482,
0.7086914777755737,
0.11585089564323425,
-0.9491676092147827,
-0.21519911289215088,
-1.3607854843139648,
0.26760274171829224,
-0.29237523674964905,
1.183863878250122,
-0.13562816381454468,
0.3620379567146301,
-0.9146274328231812,
-0.566443920135498... |
func ProcessRotateLeft(data []byte, amount int) []byte {
out := make([]byte, len(data))
for i := range data {
out[i] = bits.RotateLeft8(data[i], amount)
}
return out
} | [
0.3975948691368103,
-0.006069615483283997,
0.4477674961090088,
-0.7121543884277344,
0.4374271035194397,
-0.10949767380952835,
-0.460693359375,
-1.3594383001327515,
1.1433442831039429,
1.5106568336486816,
-0.15066419541835785,
0.22205424308776855,
-1.3056063652038574,
0.1500549614429474,
... |
func ProcessRotateRight(data []byte, amount int) []byte {
return ProcessRotateLeft(data, -amount)
} | [
0.4988170266151428,
-0.25343427062034607,
0.5388615131378174,
-0.6508657932281494,
-0.6200546026229858,
-0.4316437244415283,
-0.864795446395874,
-1.0662082433700562,
0.7549564838409424,
0.7416221499443054,
0.10035772621631622,
0.06533120572566986,
-0.9783440232276917,
0.5103737115859985,
... |
func ProcessZlib(in []byte) ([]byte, error) {
b := bytes.NewReader(in)
// FIXME zlib.NewReader allocates a bunch of memory. In the future
// we could reuse it by using a sync.Pool if this is called in a tight loop.
r, err := zlib.NewReader(b)
if err != nil {
return nil, err
}
return ioutil.ReadAll(r)
} | [
-0.1540696769952774,
-0.6526739597320557,
0.6958070397377014,
-0.05234120041131973,
-0.602949857711792,
-0.8578026294708252,
0.14124561846256256,
-0.7390857338905334,
0.4106757938861847,
0.20518869161605835,
0.0040947264060378075,
-0.07588224112987518,
-1.0418245792388916,
-0.0153180081397... |
func BytesToStr(in []byte, decoder *encoding.Decoder) (string, error) {
i := bytes.NewReader(in)
o := transform.NewReader(i, decoder)
d, e := ioutil.ReadAll(o)
if e != nil {
return "", e
}
return string(d), nil
} | [
-0.5568235516548157,
-0.3252299129962921,
0.007980355992913246,
-1.4190223217010498,
-0.693496584892273,
-0.6189749240875244,
-0.80686354637146,
-0.4510423541069031,
-0.07801654934883118,
0.02882695198059082,
-1.1784814596176147,
0.0888480618596077,
0.11989695578813553,
0.05346795171499252... |
func StringReverse(s string) string {
r := []rune(s)
for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
r[i], r[j] = r[j], r[i]
}
return string(r)
} | [
-0.7419740557670593,
-0.36438241600990295,
0.46595725417137146,
-0.5801020264625549,
-0.4464966654777527,
-0.5603209137916565,
0.07443202286958694,
-0.17936918139457703,
-0.37162062525749207,
0.38087013363838196,
-0.5561575293540955,
0.9774525165557861,
-0.9713618159294128,
-1.737888932228... |
func BytesTerminate(s []byte, term byte, includeTerm bool) []byte {
n, srcLen := 0, len(s)
for n < srcLen && s[n] != term {
n++
}
if includeTerm && n < srcLen {
n++
}
return s[:n]
} | [
0.6915031671524048,
-0.6546087265014648,
0.6408926248550415,
-0.0535070076584816,
-0.7073418498039246,
-0.5370583534240723,
-1.444514513015747,
0.365311861038208,
0.4796930253505707,
1.0000942945480347,
-1.090431571006775,
1.0118235349655151,
-1.6366671323776245,
-1.0641494989395142,
0.0... |
func BytesStripRight(s []byte, pad byte) []byte {
n := len(s)
for n > 0 && s[n-1] == pad {
n--
}
return s[:n]
} | [
-0.08624783903360367,
0.12700076401233673,
0.5487952828407288,
-0.021543269976973534,
-0.5528255105018616,
0.5284833908081055,
-1.2344403266906738,
-0.5855062007904053,
0.6551493406295776,
0.08565101772546768,
-0.1178726926445961,
0.8871196508407593,
-0.4206655025482178,
-0.133889496326446... |
func wrapString(str string, limit int) string {
var b strings.Builder
lines := strings.Split(str, "\n")
for i, line := range lines {
var currentLine string
words := strings.Fields(line)
for _, word := range words {
lineLength := len(currentLine + word)
// Only factor in spaces if the current line is not ... | [
0.18429818749427795,
0.1603778749704361,
0.7298731803894043,
-0.646639883518219,
-0.7879915833473206,
-0.47950106859207153,
0.07862769812345505,
0.0977109894156456,
0.31840115785598755,
0.04094753414392471,
1.5077025890350342,
0.641273021697998,
0.6094332933425903,
-0.7028900384902954,
0... |
func NewWorker(
ctx context.Context,
id int,
pm hub.PackageManager,
is img.Store,
ec tracker.ErrorsCollector,
httpClient HTTPGetter,
rl *rate.Limiter,
) *Worker {
return &Worker{
ctx: ctx,
id: id,
pm: pm,
is: is,
ec: ec,
hg: httpClient,
logger: log.With().Int("worker", id).L... | [
-0.29310739040374756,
-0.21707162261009216,
0.2610243558883667,
0.13029271364212036,
-0.24334819614887238,
0.2967647314071655,
-0.5656248927116394,
-0.25015339255332947,
1.285746455192566,
0.0009544176864437759,
-0.1591119021177292,
0.21045057475566864,
-0.2118528187274933,
0.1333866715431... |
func (w *Worker) Run(wg *sync.WaitGroup, queue chan *Job) {
defer wg.Done()
for {
select {
case j, ok := <-queue:
if !ok {
return
}
md := j.ChartVersion.Metadata
w.logger.Debug().
Str("repo", j.Repo.Name).
Str("chart", md.Name).
Str("version", md.Version).
Int("jobKind", int(j.Kind... | [
-0.6860211491584778,
-0.6956849694252014,
0.6944014430046082,
-0.8058174252510071,
0.39151182770729065,
0.17765645682811737,
0.21247068047523499,
-0.2987162470817566,
-1.025632381439209,
0.19296801090240479,
-0.7441228032112122,
0.5162515044212341,
-0.23354089260101318,
0.7688024640083313,... |
func (w *Worker) getImage(u string) ([]byte, error) {
// Image in data url
if strings.HasPrefix(u, "data:") {
dataURL, err := dataurl.DecodeString(u)
if err != nil {
return nil, err
}
return dataURL.Data, nil
}
// Download image using url provided
resp, err := w.hg.Get(u)
if err != nil {
return nil,... | [
-1.2566324472427368,
0.5889315605163574,
0.7534389495849609,
0.6200416684150696,
0.12312119454145432,
-0.4302588403224945,
-0.587863028049469,
0.040966302156448364,
-0.3110731542110443,
0.244967982172966,
-0.026213914155960083,
0.538960874080658,
-0.9014523029327393,
0.6066669821739197,
... |
func (w *Worker) handleRegisterJob(j *Job) error {
defer func() {
if r := recover(); r != nil {
w.logger.Error().
Str("repo", j.Repo.Name).
Str("chart", j.ChartVersion.Metadata.Name).
Str("version", j.ChartVersion.Metadata.Version).
Bytes("stacktrace", debug.Stack()).
Interface("recover", r).
... | [
0.31581321358680725,
0.0724097192287445,
0.970816969871521,
-0.42088398337364197,
-0.18222205340862274,
0.07333528250455856,
0.11929815262556076,
-0.3022741973400116,
-0.12088420242071152,
0.7225160598754883,
-0.9683510661125183,
0.17380018532276154,
0.5603764653205872,
-0.4667745232582092... |
func (w *Worker) handleUnregisterJob(j *Job) error {
// Unregister package
p := &hub.Package{
Name: j.ChartVersion.Name,
Version: j.ChartVersion.Version,
Repository: j.Repo,
}
err := w.pm.Unregister(w.ctx, p)
if err != nil {
w.ec.Append(
j.Repo.RepositoryID,
fmt.Errorf("error unregistering p... | [
-0.11890518665313721,
0.18430349230766296,
0.3926137685775757,
-0.37270069122314453,
0.56711745262146,
-0.2086264193058014,
0.3342134654521942,
0.5692030787467957,
-0.40207767486572266,
0.3183523714542389,
-0.9230977892875671,
-0.8604238629341125,
-0.5208730697631836,
0.12968914210796356,
... |
func (w *Worker) loadChart(u string) (*chart.Chart, error) {
// Rate limit requests to Github to avoid them being rejected
if strings.HasPrefix(u, "https://github.com") {
_ = w.rl.Wait(w.ctx)
}
resp, err := w.hg.Get(u)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode == http.Sta... | [
0.2172008752822876,
0.35957640409469604,
0.8396543860435486,
0.2589757740497589,
-0.6666892766952515,
0.0977550595998764,
-0.9066325426101685,
-0.5116658210754395,
0.8967912197113037,
-0.6765203475952148,
0.33066144585609436,
0.7185265421867371,
-0.7914157509803772,
0.05268986150622368,
... |
func (w *Worker) chartVersionHasProvenanceFile(u string) (bool, error) {
resp, err := w.hg.Get(u + ".prov")
if err != nil {
return false, err
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
return true, nil
}
return false, nil
} | [
0.5385125279426575,
0.10843031853437424,
0.9412413835525513,
0.09093863517045975,
0.08248193562030792,
0.6754211783409119,
0.16237308084964752,
1.043284296989441,
-0.8934412598609924,
0.344082772731781,
-0.25751227140426636,
-0.44509005546569824,
-0.25061267614364624,
0.06771350651979446,
... |
func getFile(chart *chart.Chart, name string) *chart.File {
for _, file := range chart.Files {
if file.Name == name {
return file
}
}
return nil
} | [
1.05221688747406,
-0.5136342644691467,
0.5191661715507507,
-0.4057881534099579,
0.0627145990729332,
-0.2009831666946411,
0.04313509538769722,
-0.990071177482605,
-0.691570520401001,
-0.2282133251428604,
0.3729734420776367,
0.6369178891181946,
0.14430640637874603,
-0.576242208480835,
-0.0... |
func Map(ctx context.Context, base name.Reference, tag name.Tag, fn Mutator) (name.Digest, error) {
auth, err := authn.DefaultKeychain.Resolve(base.Context())
if err != nil {
return name.Digest{}, err
}
ropt := remote.WithAuth(auth)
// TODO(mattmoor): We can be more clever here to achieve incrementality,
// bu... | [
-0.589043378829956,
-0.5167844295501709,
0.9063353538513184,
0.0669553354382515,
-0.18815679848194122,
-0.6395434141159058,
-0.29466983675956726,
-0.6546322107315063,
0.6860613226890564,
0.4804554581642151,
0.13276177644729614,
0.4550744891166687,
1.0077965259552002,
-0.49885094165802,
1... |
func NewBufferSink() *BufferSink {
return &BufferSink{}
} | [
0.43147557973861694,
-0.4738408625125885,
0.016931045800447464,
0.03862525895237923,
-0.3553365468978882,
-0.6572585701942444,
0.1649004966020584,
-1.099224328994751,
0.03300777077674866,
-1.7412869930267334,
-1.2137172222137451,
1.8984729051589966,
0.22320830821990967,
0.4262077212333679,... |
func (s *BufferSink) Open() error {
s.open = true
return nil
} | [
-0.13717442750930786,
0.33275794982910156,
0.17004898190498352,
-0.0876590833067894,
0.34108221530914307,
0.04101388901472092,
1.532921552658081,
0.7899037599563599,
-0.28253990411758423,
-1.3503315448760986,
-0.8518009185791016,
0.6537805199623108,
-0.08452122658491135,
0.4844309985637665... |
func (s *BufferSink) Close() error {
s.open = false
return nil
} | [
0.0367862731218338,
-0.0001405425718985498,
0.3285132050514221,
-0.35802024602890015,
0.3792945146560669,
0.19812634587287903,
1.4124722480773926,
-0.179681196808815,
-0.7162715196609497,
-1.4544353485107422,
-0.48971012234687805,
0.4676685333251953,
-0.7482290267944336,
0.6451895236968994... |
func (s *BufferSink) Write(b []byte) (n int, err error) {
return s.buf.Write(b)
} | [
-0.9380965828895569,
0.2998305857181549,
0.29385313391685486,
1.1715953350067139,
1.3396999835968018,
-0.7232094407081604,
1.5895897150039673,
0.18899808824062347,
-0.060222916305065155,
-0.5186922550201416,
-1.3682994842529297,
0.2041509598493576,
-0.4055565893650055,
0.7616762518882751,
... |
func (s *BufferSink) String() string {
return s.buf.String()
} | [
0.7420786619186401,
-1.1438738107681274,
0.015590625815093517,
-0.08543785661458969,
0.4028838574886322,
-0.24981391429901123,
1.419145107269287,
-1.3832066059112549,
-0.21022078394889832,
-1.0573409795761108,
-0.6062495708465576,
1.1536911725997925,
-0.0018101881723850965,
-0.067665368318... |
func (s *BufferSink) Bytes() []byte {
return s.buf.Bytes()
} | [
0.10883063822984695,
-0.39756783843040466,
0.26422151923179626,
-0.2831543982028961,
1.0912373065948486,
-0.5628257393836975,
0.14062796533107758,
-0.7571661472320557,
0.2865689694881439,
-1.2286123037338257,
-0.9081763029098511,
1.2409558296203613,
0.18563485145568848,
0.4367540180683136,... |
func testWorker() *library.Worker {
i64 := int64(0)
str := ""
b := false
arr := []string{}
return &library.Worker{
ID: &i64,
Hostname: &str,
Address: &str,
Routes: &arr,
Active: &b,
LastCheckedIn: &i64,
BuildLimit: &i64,
}
} | [
-0.4196036756038666,
-0.6610718965530396,
0.5530145764350891,
-0.14476236701011658,
-0.05888190120458603,
0.2788192927837372,
0.31888526678085327,
-0.25860172510147095,
0.41481974720954895,
-1.18940269947052,
-0.588459849357605,
-0.7228801846504211,
-1.423265814781189,
0.20478227734565735,... |
func GetManagementAgentGroupByEnumValues() []ManagementAgentGroupByEnum {
values := make([]ManagementAgentGroupByEnum, 0)
for _, v := range mappingManagementAgentGroupBy {
values = append(values, v)
}
return values
} | [
-0.32781872153282166,
-0.13268904387950897,
0.3764709532260895,
0.05349593237042427,
-0.04654891788959503,
0.27795693278312683,
-0.3345354497432709,
-0.23296211659908295,
-0.11053088307380676,
-0.009956753812730312,
0.30111241340637207,
-0.01087198406457901,
-0.20238173007965088,
1.1781312... |
func New(x io.ReadWriter) *WattsonBridge {
return &WattsonBridge{
Serial: NewSerial(x),
Silent: true,
}
} | [
0.4989253282546997,
-1.051064133644104,
0.2238139659166336,
0.1200883537530899,
-1.5631906986236572,
0.09700313210487366,
-0.2611246705055237,
-0.7458638548851013,
0.010841445997357368,
-0.24945542216300964,
-0.5038329362869263,
-0.2683984637260437,
0.16514261066913605,
1.3406094312667847,... |
func (w *WattsonBridge) BaseValue(cmd rune, base int) int {
raw := w.Do(cmd)
if len(raw) == 0 || rune(raw[0]) != cmd {
return -1
}
v, err := strconv.ParseInt(raw[1:], base, 64)
if err != nil {
return -1
}
return int(v)
} | [
-0.25928571820259094,
-0.2925167381763458,
0.8615710139274597,
0.7042837738990784,
-0.7939286231994629,
-0.5398045182228088,
0.1557244062423706,
0.11995694786310196,
-0.8677677512168884,
0.058906614780426025,
1.1319897174835205,
0.44674018025398254,
-0.944709300994873,
0.8317725658416748,
... |
func (w *WattsonBridge) HexValue(cmd rune) int {
return w.BaseValue(cmd, 16)
} | [
0.21449574828147888,
-0.059805840253829956,
0.47877249121665955,
-0.05157606676220894,
-0.47306907176971436,
0.29166293144226074,
0.11001379042863846,
0.8780826330184937,
-0.42074620723724365,
-0.8801815509796143,
0.31066685914993286,
0.09879319369792938,
0.1143995076417923,
1.627751946449... |
func (w *WattsonBridge) DecValue(cmd rune) int {
return w.BaseValue(cmd, 10)
} | [
0.20600515604019165,
0.3233798146247864,
0.6033424139022827,
-0.3091354966163635,
-0.39981013536453247,
-0.1491338163614273,
0.8120840787887573,
0.6183555126190186,
-0.6530294418334961,
-0.5276492834091187,
0.624710202217102,
0.21326743066310883,
-0.1420118510723114,
1.2481764554977417,
... |
func (w *WattsonBridge) Series(cmd rune, arg string) []int {
raw := w.DoArg(cmd, arg)
if len(raw) == 0 || rune(raw[0]) != cmd {
return nil
}
out := make([]int, 0)
parts := strings.Split(raw[1:], ",")
for _, str := range parts {
v, err := strconv.ParseInt(str, 16, 64)
if err != nil {
v = -1
}
out = ... | [
-0.6908946633338928,
0.22516202926635742,
0.5650638937950134,
-0.07230226695537567,
0.10734448581933975,
-1.0118408203125,
0.23177114129066467,
-0.4039123058319092,
0.3056265115737915,
0.3040143847465515,
0.2309037744998932,
0.9620149731636047,
-0.5814820528030396,
-0.05042313039302826,
... |
func (w *WattsonBridge) Do(cmd rune) string {
return w.DoArg(cmd, "")
} | [
0.013497046194970608,
0.26106274127960205,
0.5520491003990173,
-0.27833256125450134,
-0.17879429459571838,
0.8607577681541443,
-0.28824877738952637,
-1.020577311515808,
-0.476901113986969,
0.29926010966300964,
0.24858881533145905,
0.6377608180046082,
-0.6640450954437256,
1.4335603713989258... |
func (w *WattsonBridge) DoArg(cmd rune, arg string) string {
out, err := w.Serial.Do(fmt.Sprintf("now%c%s", cmd, arg))
if !w.Silent {
var note string
if arg != "" {
note = fmt.Sprintf("%c.%s", cmd, arg)
} else {
note = fmt.Sprintf("%c", cmd)
}
if err != nil {
log.Printf("err(%s): %s", note, err)
... | [
-0.07707871496677399,
-0.34583234786987305,
1.016473650932312,
-0.44057518243789673,
-0.3013823330402374,
0.5787298083305359,
0.14978522062301636,
0.1092146560549736,
-0.37175601720809937,
0.9573071599006653,
1.2059727907180786,
0.9046704769134521,
-0.4168202877044678,
1.0897080898284912,
... |
func GenRedeployPipelineYaml(runtimeID uint64) apistructs.PipelineYml {
yml := apistructs.PipelineYml{
Version: "1.1",
Stages: [][]*apistructs.PipelineYmlAction{
{{
Type: "dice-deploy-redeploy",
Alias: "dice-deploy-redeploy",
Version: "1.0",
Params: map[string]interface{}{
"runtime_id"... | [
-0.8131072521209717,
-0.6572761535644531,
0.8316280841827393,
-0.7941576838493347,
-0.4866085648536682,
-0.6406978368759155,
-0.0023033006582409143,
0.531353235244751,
-0.09744240343570709,
1.2043155431747437,
0.061205390840768814,
1.2117655277252197,
1.1753318309783936,
0.5167341232299805... |
func GenCreateByReleasePipelineYaml(releaseID string, workspaces []string) apistructs.PipelineYml {
yml := apistructs.PipelineYml{
Version: "1.1",
Stages: [][]*apistructs.PipelineYmlAction{
{},
{},
{},
{},
},
}
for _, workspace := range workspaces {
yml.Stages[0] = append(yml.Stages[0], &apistruc... | [
-0.3162258565425873,
-0.4734538495540619,
0.7786563038825989,
-0.5935828685760498,
-0.10162265598773956,
-0.019217193126678467,
0.5546205043792725,
0.004157159943133593,
-0.1289583146572113,
1.1080976724624634,
-0.5546907782554626,
0.27493032813072205,
1.181145429611206,
0.5243250727653503... |
func FindCRBRRunningPipeline(appID uint64, env string, ymlName string, bdl *bundle.Bundle) ([]apistructs.PagePipeline, error) {
var result []apistructs.PagePipeline
pipelinePageReq := apistructs.PipelinePageListRequest{
Sources: []apistructs.PipelineSource{apistructs.PipelineSourceDice},
Statuses: []string{"Runn... | [
-0.46022361516952515,
-1.273553729057312,
0.4854731559753418,
0.030857505276799202,
0.6272854208946228,
0.042937420308589935,
-0.6708552241325378,
0.23235473036766052,
-0.5432852506637573,
1.3004502058029175,
-0.15693408250808716,
0.5379889607429504,
-0.8209103941917419,
1.1153178215026855... |
func FindCreatingRuntimesByRelease(appID uint64, envs map[string][]string, ymlName string, bdl *bundle.Bundle) ([]apistructs.RuntimeSummaryDTO, error) {
var result []apistructs.RuntimeSummaryDTO
pipelinePageReq := apistructs.PipelinePageListRequest{
Sources: []apistructs.PipelineSource{apistructs.PipelineSourceDic... | [
-0.6101480722427368,
0.186052605509758,
0.8224902153015137,
0.10256882011890411,
0.47439756989479065,
-0.5801035165786743,
-0.6332857608795166,
0.19735948741436005,
-0.3180171549320221,
1.2010135650634766,
-0.1356676071882248,
-0.20187784731388092,
-0.2969590127468109,
1.2999264001846313,
... |
func isUndoneTaskOFDeployByRelease(piplineDetail *pipelinepb.PipelineDetailDTO) bool {
if len(piplineDetail.PipelineStages) == 0 || len(piplineDetail.PipelineStages[0].PipelineTasks) == 0 {
return false
}
task := piplineDetail.PipelineStages[0].PipelineTasks[0]
return task.Type == "dice-deploy-release" && !apist... | [
-0.8141664266586304,
-0.05908052995800972,
0.6371532082557678,
0.33073219656944275,
-0.11905917525291443,
-0.23331907391548157,
0.3910426199436188,
0.7738751769065857,
-0.016455773264169693,
0.9222326874732971,
-0.11435960978269577,
-0.4121452271938324,
0.1022656187415123,
0.97258144617080... |
func ResetAPI(db *models.DB) {
// db.DropTableIfExists(&models.Users{})
db.DropTableIfExists(&models.Consultant{})
db.DropTableIfExists(&models.ReportedRecord{})
db.DropTableIfExists(&models.Rate{})
db.DropTableIfExists(&models.Project{})
db.DropTableIfExists(&models.Holiday{})
fmt.Println("recreated tables:")... | [
-0.36919137835502625,
0.2361363172531128,
0.5961923599243164,
0.6079175472259521,
0.9933502078056335,
0.8262119889259338,
0.7134557366371155,
-0.40908247232437134,
-0.5579896569252014,
0.06325004994869232,
-0.5827621817588806,
-0.012106174603104591,
-0.5093811750411987,
0.5407858490943909,... |
func SeedAPI(db *models.DB, table string) {
api := NewAPI(db)
fmt.Println("Loaded table, # of records, filename:")
switch table {
case "rates", "consultants", "projects", "reported_records", "holidays":
SeedTable(api, table)
case "all":
// users
SeedTable(api, "rates")
SeedTable(api, "consultants")
SeedT... | [
0.07335954159498215,
0.45810338854789734,
0.3428901433944702,
0.39045530557632446,
-0.17651712894439697,
0.394432008266449,
0.31151723861694336,
0.029263261705636978,
-0.3649578392505646,
0.5864883065223694,
0.050343260169029236,
-0.3055710792541504,
-0.11526310443878174,
0.608581125736236... |
func CheckAndInitAPI(db *models.DB) (api *API) {
fmt.Println("checking DB ...")
emptyTable := false
api = NewAPI(db)
if api.rates.RateCount() == 0 {
SeedTable(api, "rates")
emptyTable = true
}
if api.consultants.ConsultantCount() == 0 {
SeedTable(api, "consultants")
emptyTable = true
}
if api.projects.P... | [
-0.5723791718482971,
-0.4516310393810272,
0.48109614849090576,
-0.3048825263977051,
-0.13691018521785736,
0.8651210069656372,
0.055928006768226624,
-0.3527870774269104,
-0.19437816739082336,
0.04081274941563606,
0.052971430122852325,
-0.3148447871208191,
-0.5163487195968628,
0.836657524108... |
func BackupAPI(rotation int, folder string, db *models.DB) {
api := NewAPI(db)
id := time.Now().Format("2006-01-02_150405")
fmt.Println("backuped tables:")
tableNames := []string{"rates", "projects", "reported_records", "consultants", "holidays"}
for _, baseFileName := range tableNames {
err := rotateBackupFil... | [
-0.7638508677482605,
-0.27677932381629944,
0.8312578797340393,
0.3879309594631195,
0.4065682590007782,
0.26102733612060547,
0.8322389721870422,
-0.19524216651916504,
-0.8746723532676697,
0.4845847189426422,
-0.20720574259757996,
-0.5068202614784241,
-0.4207112789154053,
-0.0118626737967133... |
func (j *JSONData) get(path ...interface{}) (*sj.Json, error) {
json, err := sj.NewJson(j.data)
if err != nil {
return nil, err
}
for _, p := range path {
switch p.(type) {
case string:
dt, err := strconv.Atoi(p.(string))
if err == nil {
json = json.GetIndex(dt)
continue
}
json = json.Get(... | [
-1.3307079076766968,
-0.8257997035980225,
0.9673513174057007,
-0.3526111841201782,
-0.5382902026176453,
-0.38502737879753113,
0.11862880736589432,
-0.4849017560482025,
-0.9495708346366882,
0.02457570657134056,
-0.14263394474983215,
1.201587438583374,
-0.1978394240140915,
-0.189780503511428... |
func (j *JSONData) String(path ...interface{}) (string, error) {
json, err := j.get(path...)
return json.MustString(), err
} | [
-1.0340180397033691,
-0.7707149386405945,
0.31256401538848877,
-0.5621250867843628,
-0.7881734371185303,
0.5646291971206665,
-0.2264760434627533,
-1.6134884357452393,
-1.1249483823776245,
-0.007676171138882637,
-0.0010735586984083056,
0.8381839990615845,
-0.11607518792152405,
-0.3409361243... |
func (j *JSONData) Map(path ...interface{}) (map[string]interface{}, error) {
json, err := j.get(path...)
return json.MustMap(), err
} | [
-1.482337474822998,
-0.2386232614517212,
0.773343563079834,
-0.20239800214767456,
-0.670105516910553,
1.0232065916061401,
-0.8987454771995544,
-0.6560854911804199,
-0.3126896321773529,
0.5141667723655701,
0.04484854266047478,
0.17790460586547852,
0.709720253944397,
-0.1397181898355484,
-... |
func (j *JSONData) Array(path ...interface{}) ([]interface{}, error) {
json, err := j.get(path...)
return json.MustArray(), err
} | [
-1.3703348636627197,
-0.741596519947052,
0.7480306029319763,
-0.006715528201311827,
0.2748355567455292,
0.32737699151039124,
-0.8818566203117371,
-0.8912836909294128,
-1.1895924806594849,
0.2665199041366577,
0.08774034678936005,
0.8772245049476624,
-0.28143659234046936,
0.8472231030464172,... |
func (j *JSONData) Bool(path ...interface{}) (bool, error) {
json, err := j.get(path...)
return json.MustBool(), err
} | [
-0.9294623136520386,
-0.06953329592943192,
0.6790476441383362,
-0.15998265147209167,
-0.20210425555706024,
0.8139487504959106,
-0.5049043893814087,
0.2749033570289612,
-1.279847264289856,
-0.017452983185648918,
0.09580305963754654,
0.7412330508232117,
0.41083648800849915,
-1.02769398689270... |
func (j *JSONData) Int(path ...interface{}) (int, error) {
json, err := j.get(path...)
return json.MustInt(), err
} | [
-0.818662703037262,
-0.13443860411643982,
0.6908388733863831,
-0.8280010223388672,
-0.3332224488258362,
-0.10851603001356125,
-0.4757581055164337,
-0.5736916065216064,
-1.73038649559021,
0.09979701787233353,
0.06394874304533005,
0.2906504273414612,
0.016855349764227867,
-0.1698838025331497... |
func (j *JSONData) Int64(path ...interface{}) (int64, error) {
json, err := j.get(path...)
return json.MustInt64(), err
} | [
-1.695115566253662,
-0.1613238900899887,
0.631111204624176,
0.4364679455757141,
-0.05197852849960327,
-0.4013320803642273,
-0.6147259473800659,
-0.18361786007881165,
-0.975709080696106,
-0.4031136929988861,
0.45122700929641724,
-0.08039724081754684,
-0.5562912225723267,
-0.0119683509692549... |
func (j *JSONData) Float64(path ...interface{}) (float64, error) {
json, err := j.get(path...)
return json.MustFloat64(), err
} | [
-1.1923058032989502,
-0.09807823598384857,
0.6973228454589844,
0.39731478691101074,
0.47812148928642273,
-0.29624900221824646,
-0.38897204399108887,
-0.5630432367324829,
-1.1908671855926514,
-0.6042711734771729,
0.3051496744155884,
-0.1322145313024521,
-0.4199680984020233,
0.44434034824371... |
func (j *JSONData) Uint64(path ...interface{}) (uint64, error) {
json, err := j.get(path...)
return json.MustUint64(), err
} | [
-1.7308398485183716,
-0.2446655035018921,
0.6982606649398804,
0.25389522314071655,
-0.06292412430047989,
-0.27857261896133423,
-0.7146620750427246,
0.08483026176691055,
-0.869799792766571,
-0.5197609663009644,
0.6681084036827087,
-0.7746043801307678,
0.13615360856056213,
0.0445988290011882... |
func (j *JSONData) StrArray(path ...interface{}) ([]string, error) {
json, err := j.get(path...)
return json.MustStringArray(), err
} | [
-1.6523667573928833,
-1.0587821006774902,
0.5873122811317444,
-0.5553333759307861,
-0.20601145923137665,
0.23383332788944244,
-0.9458534121513367,
-1.128045916557312,
-1.113654375076294,
0.37280020117759705,
0.5422787666320801,
0.49134591221809387,
-0.9502457976341248,
0.50606769323349,
... |
func (j *JSONData) SetPath(v interface{}, path ...string) error {
json, err := sj.NewJson(j.data)
if err != nil {
return err
}
json.SetPath(path, v)
bt, err := json.MarshalJSON()
if err != nil {
return err
}
j.data = bt
return nil
} | [
-0.5014194846153259,
-0.07345771044492722,
0.3793938159942627,
0.037908703088760376,
-0.6722981333732605,
0.2865489423274994,
-0.18873104453086853,
-0.23427343368530273,
-0.1195126622915268,
0.5842030048370361,
-0.7811000943183899,
0.2686120569705963,
-0.1635613739490509,
0.158651337027549... |
func (j *JSONData) FormatString() string {
return string(j.data)
} | [
-0.7156997323036194,
-0.8978274464607239,
0.4286126494407654,
-0.8318049311637878,
-0.792959451675415,
0.3967905342578888,
-0.4049285650253296,
-1.1182429790496826,
0.21336112916469574,
-0.360159307718277,
1.3383595943450928,
0.3634697496891022,
0.3074409067630768,
0.4073379337787628,
-0... |
func Self() string {
return naiveSelf()
} | [
-0.24663813412189484,
-1.2397758960723877,
0.5028198957443237,
0.4748965799808502,
-0.9849501848220825,
0.4332471191883087,
0.6723396182060242,
-0.34031957387924194,
-0.46989989280700684,
-1.0149779319763184,
-0.6497389078140259,
0.3103271424770355,
0.027626600116491318,
0.1591200530529022... |
func Command(args ...string) *exec.Cmd {
return &exec.Cmd{
Path: Self(),
Args: args,
}
} | [
0.1674860715866089,
-1.1191253662109375,
0.4121955931186676,
0.4511794149875641,
0.6988371014595032,
0.6775152087211609,
-0.16908642649650574,
0.13121464848518372,
0.1123112216591835,
-1.5708245038986206,
0.7677151560783386,
1.085383415222168,
0.36046579480171204,
0.03826232999563217,
-0... |
func NewCodec() *Codec {
return &Codec{}
} | [
0.9760614037513733,
-1.3355858325958252,
0.1162862554192543,
0.7681875824928284,
-1.299363374710083,
0.0687946304678917,
0.7397388219833374,
-0.42998796701431274,
0.283391535282135,
-1.3415924310684204,
0.520885169506073,
1.3275949954986572,
0.9973061680793762,
0.20369406044483185,
0.285... |
func (c *Codec) NewRequest(r *http.Request) rpc.CodecRequest {
return newCodecRequest(r)
} | [
-0.4074449837207794,
0.08391083776950836,
0.5073540210723877,
0.024919314309954643,
-0.6750350594520569,
-0.07424116879701614,
-0.8325963616371155,
-0.6186351776123047,
0.6165242791175842,
-0.5923764109611511,
0.4699855148792267,
0.8499641418457031,
-0.059924278408288956,
0.476344376802444... |
func newCodecRequest(r *http.Request) rpc.CodecRequest {
// Decode the request body and check if RPC method is valid.
req := new(serverRequest)
err := json.NewDecoder(r.Body).Decode(req)
return &CodecRequest{request: req, err: err}
} | [
-0.813869059085846,
-0.5128916501998901,
0.45160526037216187,
-0.3026825189590454,
-1.0725196599960327,
-0.13316242396831512,
-1.2937606573104858,
-0.6657119393348694,
0.1306162029504776,
-0.1792771965265274,
0.11303844302892685,
0.6939070224761963,
-0.5936123132705688,
0.5881744623184204,... |
func (c *CodecRequest) Method() (string, error) {
if c.err == nil {
return c.request.Method, nil
}
return "", c.err
} | [
-0.7791674137115479,
0.3089522123336792,
0.6489726901054382,
-0.4385058879852295,
-0.28230714797973633,
-0.04902171343564987,
-0.3637167513370514,
-1.16373872756958,
0.2109038233757019,
-0.1013258621096611,
0.9627360701560974,
0.29389986395835876,
0.18319407105445862,
0.9598869681358337,
... |
func (c *CodecRequest) ReadRequest(args interface{}) error {
if c.err == nil {
if c.request.Params != nil {
// JSON params is array value. RPC params is struct.
// Unmarshal into array containing the request struct.
params := [1]interface{}{args}
c.err = json.Unmarshal(*c.request.Params, ¶ms)
} els... | [
-1.5798348188400269,
-0.24634793400764465,
0.7178173065185547,
-0.275143563747406,
0.4656728506088257,
-0.17740172147750854,
-0.4877163767814636,
-0.431142121553421,
-0.740302324295044,
0.307274729013443,
1.334431767463684,
0.14624404907226562,
-0.40983471274375916,
0.28780946135520935,
... |
func (c *CodecRequest) WriteResponse(w http.ResponseWriter, reply interface{}) {
if c.request.Id != nil {
// Id is null for notifications and they don't have a response.
res := &serverResponse{
Result: reply,
Error: &null,
Id: c.request.Id,
}
c.writeServerResponse(w, 200, res)
}
} | [
-0.5347972512245178,
0.08471168577671051,
0.46806278824806213,
-0.3322737514972687,
1.2990648746490479,
-0.634772539138794,
0.3634742498397827,
-0.49881890416145325,
0.7073541879653931,
0.06626394391059875,
-0.520538866519928,
-0.06724174320697784,
-0.4425533711910248,
0.8805087208747864,
... |
func mergeURL(pageURL string, URL string) string {
u, _ := url.Parse(URL)
base, _ := url.Parse(pageURL)
return fmt.Sprintf("%s", base.ResolveReference(u))
} | [
-0.15878956019878387,
-0.6345030665397644,
0.6298550963401794,
0.0405937023460865,
0.5005989074707031,
-0.008696405217051506,
-1.6722557544708252,
0.768707811832428,
0.18942749500274658,
-0.15006518363952637,
0.2489149421453476,
0.22455449402332306,
-0.13772842288017273,
-0.074285328388214... |
func SummaryHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Add(headerContentType, contentTypeJSON)
w.Header().Add(headerAccessControlAllowOrigin, "*")
URL := r.URL.Query().Get("url")
defer r.URL.Query()
fmt.Println("current url :" + URL)
if URL == "" {
http.Error(w, "Bad Request, no parameter k... | [
-0.9431098699569702,
-0.7374938726425171,
1.0186179876327515,
0.27580830454826355,
-0.6645437479019165,
0.02470352128148079,
0.4547724723815918,
-0.19227316975593567,
0.6620445251464844,
0.0799790471792221,
0.794643223285675,
-0.26229164004325867,
-0.44608694314956665,
-0.11981890350580215... |
func extractSummary(pageURL string, htmlStream io.ReadCloser) (*PageSummary, error) {
pageSummary := &PageSummary{}
previewImages := []*PreviewImage{}
previewImage := &PreviewImage{}
// Create a new tokenizer instance for http response body
tokenizer := html.NewTokenizer(htmlStream)
for {
//get the next to... | [
-0.6695488691329956,
-0.17222101986408234,
0.8316640257835388,
-0.14406542479991913,
-0.8856775164604187,
-0.4007991552352905,
-0.6117018461227417,
-0.1800430715084076,
0.15687105059623718,
0.16464662551879883,
0.04353904351592064,
0.3417114317417145,
0.6825189590454102,
0.5155494213104248... |
func howManyGames(p int32, d int32, m int32, s int32) int32 {
var i int32 = 0
for {
s = s - p
if s < 0 {
break
}
i++
if p-d > m {
p = p - d
} else {
p = m
}
}
return i
} | [
-0.6141993403434753,
0.5568636655807495,
0.6450300216674805,
-0.9405937194824219,
-0.5077136158943176,
0.48665720224380493,
0.18817967176437378,
-0.3304205536842346,
-0.7682345509529114,
0.41453394293785095,
0.46997085213661194,
0.4758847653865814,
-0.2787448465824127,
-0.1553179919719696,... |
func GetChannel(config_obj *api_proto.Config) *grpc.ClientConn {
address := GetAPIConnectionString(config_obj)
con, err := grpc.Dial(address, grpc.WithTransportCredentials(
getCreds(config_obj)))
if err != nil {
panic(fmt.Sprintf("Unable to connect to self: %v: %v", address, err))
}
return con
} | [
-0.5200744867324829,
-0.3044012486934662,
0.4834586977958679,
-0.0155391376465559,
0.37133774161338806,
0.41269993782043457,
0.2870923578739166,
0.41016897559165955,
-0.7858936190605164,
0.07059230655431747,
0.4006803333759308,
1.3306971788406372,
-0.8641219139099121,
-0.9315260648727417,
... |
func (s *SaleResponse) FormatResponse() *g.Response {
response := new(g.Response)
response.Acquirer = Name
if s.OrderResult != nil {
response.Id = s.OrderResult.OrderReference
response.AuthorizationCode = s.OrderResult.OrderKey
}
// If CreditCard
if len(s.CreditCardTransactionResultCollection) > 0 {
trans... | [
0.47817474603652954,
-1.1574066877365112,
0.37096652388572693,
-0.04980135336518288,
-0.22233571112155914,
-0.8412646055221558,
0.4382804334163666,
-0.28078493475914,
1.0386790037155151,
-0.008977695368230343,
0.4552251696586609,
-0.723641037940979,
-0.3234010636806488,
0.5713448524475098,... |
func CreateScriptWrapper(hookPath string) (*ScriptWrapper, error) {
var wrap = &ScriptWrapper{
hookPath: hookPath,
}
var err error
var scriptFileName string = `buildkite-agent-bootstrap-hook-runner`
var isBashHook bool
var isPwshHook bool
var isWindows = runtime.GOOS == "windows"
// we use bash hooks for sc... | [
-0.02815922722220421,
-0.3364560306072235,
0.7414917945861816,
0.37631717324256897,
-0.03234107047319412,
-0.07450726628303528,
0.12032297998666763,
-0.3352995216846466,
-0.6146829128265381,
0.6409716010093689,
0.42135927081108093,
0.6658015847206116,
0.21684673428535461,
1.003732562065124... |
func (wrap *ScriptWrapper) Path() string {
return wrap.scriptFile.Name()
} | [
-0.6249616742134094,
-1.2949074506759644,
0.20316317677497864,
-0.19178779423236847,
-0.7322386503219604,
1.2268773317337036,
0.934303343296051,
-1.5210905075073242,
-0.3829851746559143,
0.7377853393554688,
0.10718563944101334,
0.5599698424339294,
0.12913182377815247,
0.8223688006401062,
... |
func (wrap *ScriptWrapper) Close() {
os.Remove(wrap.scriptFile.Name())
os.Remove(wrap.beforeEnvFile.Name())
os.Remove(wrap.afterEnvFile.Name())
} | [
-0.6964778304100037,
-0.4753323793411255,
0.418118417263031,
-0.0809447392821312,
-0.8413017392158508,
1.0646699666976929,
0.32619765400886536,
-0.7157390713691711,
-1.2363332509994507,
0.8271355032920837,
0.4076524078845978,
0.5377895832061768,
0.09023961424827576,
1.7413702011108398,
1... |
func (wrap *ScriptWrapper) Changes() (hookScriptChanges, error) {
beforeEnvContents, err := ioutil.ReadFile(wrap.beforeEnvFile.Name())
if err != nil {
return hookScriptChanges{}, fmt.Errorf("Failed to read \"%s\" (%s)", wrap.beforeEnvFile.Name(), err)
}
afterEnvContents, err := ioutil.ReadFile(wrap.afterEnvFile.... | [
-1.2642264366149902,
-0.9230728149414062,
0.6586306095123291,
-0.4887217879295349,
-0.36953479051589966,
0.27678385376930237,
0.164384663105011,
-0.1694299578666687,
-0.6597635746002197,
0.6289010643959045,
0.09494367986917496,
0.8861643075942993,
0.4942219853401184,
1.0857666730880737,
... |
func NewSymbol(name string) Symbol {
return Symbol{Name: name}
} | [
-0.38220909237861633,
0.07684046030044556,
0.08507680892944336,
-0.2064361572265625,
-1.2912112474441528,
-0.22891774773597717,
-0.15090502798557281,
-0.5401113629341125,
0.5624477863311768,
-0.06878867000341415,
-1.8103549480438232,
0.7442952990531921,
0.5504521131515503,
-0.4394991099834... |
func (symbol Symbol) Metadata() Map {
return symbol.Meta
} | [
-1.013089895248413,
-0.23795470595359802,
0.4363252520561218,
-0.20187102258205414,
0.5061089992523193,
0.1870642602443695,
-0.02169821411371231,
-0.44142159819602966,
0.15619397163391113,
0.335679829120636,
-0.7143635153770447,
0.42727625370025635,
1.7416727542877197,
0.6033220291137695,
... |
func InitTelegramBot(service *memdb.Service) error {
ekadashiURL := os.Getenv(ekadashiURL)
if ekadashiURL == "" {
return fmt.Errorf("server URL cannot be empty")
}
s := &EkadashiBot{
db: service,
serverURL: ekadashiURL,
registerURL: "/register",
loginURL: "/login",
showEkad... | [
0.012406514957547188,
0.2983206808567047,
0.7700017690658569,
-0.5270282030105591,
0.3981500267982483,
0.7284063100814819,
-0.35985031723976135,
0.08888501673936844,
-1.040621280670166,
-0.21207675337791443,
-1.4766958951950073,
0.5653151273727417,
-0.381897509098053,
0.7287667393684387,
... |
func (s *policyClient) Patch(o *v1alpha1.Policy, patchType types.PatchType, data []byte, subresources ...string) (*v1alpha1.Policy, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*v1alpha1.Policy), err
} | [
-0.21967735886573792,
-0.4604557752609253,
0.2668677568435669,
-0.39116939902305603,
-0.6085464954376221,
1.826905369758606,
-0.3528493642807007,
-0.07173947244882584,
1.2253615856170654,
-0.007062158547341824,
-0.18698197603225708,
0.9227664470672607,
-0.558147668838501,
-0.27575662732124... |
func (r Rules) GoString() string {
var s []string
if r&ASCIIOnly != 0 {
s = append(s, "ASCIIOnly")
}
if r&ValidUTF8 != 0 {
s = append(s, "ValidUTF8")
}
if r&URLUnescaped != 0 {
s = append(s, "URLUnescaped")
}
if r&ShellSafe != 0 {
s = append(s, "ShellSafe")
}
if r&ArgumentSafe != 0 {
s = append(s, "... | [
-0.05748856067657471,
0.27504968643188477,
0.55515456199646,
-0.7042285203933716,
-0.00993378832936287,
0.2743687629699707,
-0.034748584032058716,
-0.12742845714092255,
-1.0684640407562256,
0.6499950885772705,
0.5775434374809265,
0.026754960417747498,
-0.7095514535903931,
0.347762376070022... |
func (r Rules) CheckPathSegment(name string) error {
r = (r & Strict) | always
if name == "" || name == "." || name == ".." {
return &Error{name: name, err: errBad}
}
if r&(ASCIIOnly|ValidUTF8) == ValidUTF8 {
rest := name
for len(rest) != 0 {
c, n := utf8.DecodeRuneInString(rest)
if c == utf8.RuneError ... | [
-0.04106881469488144,
-0.8431952595710754,
0.9958922863006592,
-0.33539053797721863,
-0.32885992527008057,
-0.5692964792251587,
0.45294150710105896,
-0.8791772723197937,
-0.8089305758476257,
0.7594926357269287,
-0.20278336107730865,
-0.23520638048648834,
-0.47033220529556274,
-0.0208035148... |
func (r Rules) CheckPath(name string) error {
if len(name) == 0 {
return &Error{isPath: true, path: name, err: errEmpty}
}
if name[0] == '/' {
return &Error{isPath: true, path: name, err: errAbsolute}
}
rest := name
for len(rest) != 0 {
var part string
switch i := strings.IndexByte(rest, '/'); {
case i ... | [
0.3249666094779968,
-0.38542044162750244,
0.8924288749694824,
0.5296609401702881,
-0.011167796328663826,
0.33495432138442993,
1.1392910480499268,
-0.0659438893198967,
-0.2720414996147156,
1.2294455766677856,
-0.10483928769826889,
-0.5904154181480408,
-0.8402842283248901,
0.1545439213514328... |
func CreditCard(s string) bool {
return luhn(stripNonNumeric(s))
} | [
-0.044784050434827805,
-0.2201119363307953,
0.42746829986572266,
-0.7792688608169556,
-0.5384344458580017,
1.1035915613174438,
-0.4373798370361328,
0.49628716707229614,
0.44219666719436646,
-0.3666633069515228,
0.03777257725596428,
0.010928422212600708,
-0.29615840315818787,
-0.02454422041... |
func VisaCard(s string) bool {
if len(s) == 0 {
return false
}
s = stripNonNumeric(s)
if len(s) != 13 && len(s) != 16 {
return false
}
if s[0] != '4' {
return false
}
return luhn(s)
} | [
-0.0033102454617619514,
-0.2232157289981842,
0.5791476368904114,
-0.12595680356025696,
-0.7578168511390686,
-0.2820492088794708,
-1.176039218902588,
0.27229025959968567,
0.9727038145065308,
0.7060182094573975,
-0.13166412711143494,
-0.38312748074531555,
-1.0094045400619507,
-0.762204527854... |
func MasterCard(s string) bool {
if len(s) == 0 {
return false
}
s = stripNonNumeric(s)
if len(s) != 16 {
return false
}
ft, _ := strconv.Atoi(s[0:2])
ff, _ := strconv.Atoi(s[0:4])
if s[0:1] != "5" && (55 < ft || ft < 51) && (2720 < ff || ft < 2221) {
return false
}
return luhn(s)
} | [
-0.10817187279462814,
-0.8837918639183044,
0.7563497424125671,
-0.3659237325191498,
-1.0000766515731812,
-0.2808770537376404,
-0.9887425899505615,
0.4495628774166107,
0.31268373131752014,
-0.06335552781820297,
-0.6767518520355225,
-0.048838645219802856,
-0.4992786645889282,
-0.766774177551... |
func AmericanExpressCard(s string) bool {
if len(s) == 0 {
return false
}
s = stripNonNumeric(s)
if len(s) != 15 {
return false
}
if s[0:2] != "34" && s[0:2] != "37" {
return false
}
return luhn(s)
} | [
-0.17953525483608246,
-0.17106401920318604,
0.5768470168113708,
0.007999716326594353,
-0.8997709155082703,
-0.1787542849779129,
-1.6625834703445435,
-0.16073858737945557,
0.7470191121101379,
0.3131357729434967,
-0.2813658118247986,
0.2651544213294983,
-0.13638567924499512,
0.12600407004356... |
func DinersClubCard(s string) bool {
if len(s) == 0 {
return false
}
s = stripNonNumeric(s)
if len(s) != 14 {
return false
}
ft, _ := strconv.Atoi(s[0:3])
if s[0:2] != "36" && s[0:2] != "38" && (305 < ft || ft < 300) {
return false
}
return luhn(s)
} | [
-0.9184250235557556,
-0.09743301570415497,
0.7413437366485596,
-0.11375539749860764,
-0.359056293964386,
-0.16017314791679382,
-0.8695586919784546,
0.061524100601673126,
0.40489524602890015,
-0.03152408450841904,
-0.08215827494859695,
-0.24789315462112427,
-0.20234955847263336,
-0.07690697... |
func DiscoverCard(s string) bool {
if len(s) == 0 {
return false
}
s = stripNonNumeric(s)
if len(s) != 16 {
return false
}
if s[0:2] != "65" && s[0:4] != "6011" {
return false
}
return luhn(s)
} | [
-0.11006505787372589,
0.10041926801204681,
0.7702604532241821,
-0.3419092893600464,
-0.474740207195282,
-0.42571592330932617,
-1.7081221342086792,
-0.26443547010421753,
0.6859853267669678,
-0.1459326148033142,
-0.06137390062212944,
-0.11726967990398407,
-0.6775938272476196,
0.0372530370950... |
func JCBCard(s string) bool {
if len(s) == 0 {
return false
}
s = stripNonNumeric(s)
if len(s) != 15 && len(s) != 16 {
return false
}
if s[0:4] != "2131" && s[0:4] != "1800" && s[0:2] != "35" {
return false
}
if (s[0:4] == "2131" || s[0:4] == "1800") && len(s) != 15 {
return false
}
if s[0:2] == ... | [
-0.06264107674360275,
-0.32723966240882874,
0.9995271563529968,
-0.4487353265285492,
-0.7448363304138184,
0.10942842811346054,
-0.8195511698722839,
-0.8588281869888306,
1.1597954034805298,
0.2837660312652588,
-0.39515092968940735,
0.34248340129852295,
-0.9374030828475952,
0.491895616054534... |
func Create(Ob map[string]interface{}, userId string) *utils.Response {
var (
CategoryPath, CategoryName string
ret *utils.Response
note *model.Note
filed []string
Usn int
attachlist []interface{}
pat... | [
-0.7494228482246399,
0.016545360907912254,
1.0441229343414307,
0.2554812431335449,
-0.016921868547797203,
0.6168282628059387,
0.4933129549026489,
-0.966846227645874,
-0.7124673128128052,
0.5183449387550354,
-0.3255729079246521,
-0.4531709551811218,
0.44731226563453674,
0.23062027990818024,... |
func DeleteByV2(Ob map[string]interface{}, userId string) *utils.Response {
var (
note *model.Note
path string
Usn int
)
if _, ok := Ob["Path"].(string); ok {
path = Ob["Path"].(string)
note = model.NewNote(path)
note.UID = userId
} else {
return utils.WITHOUT_PARAMETERS
}
if _, ok := Ob["UpdateTim... | [
-0.35916873812675476,
-0.25228679180145264,
1.3439064025878906,
0.5316981673240662,
-0.1720351129770279,
0.04384706914424896,
1.2086470127105713,
-0.24881677329540253,
0.11761977523565292,
0.9414684772491455,
-0.4662417769432068,
0.3258919417858124,
-0.4698401391506195,
0.00131858035456389... |
func Delete(Ob map[string]interface{}, userId string) *utils.Response {
var (
note *model.Note
path string
Usn int
)
if _, ok := Ob["Path"].(string); ok {
path = Ob["Path"].(string)
note = model.NewNote(path)
note.UID = userId
} else {
return utils.WITHOUT_PARAMETERS
}
if _, ok := Ob["UpdateTime"];... | [
-0.3459523320198059,
0.11997000873088837,
1.2769242525100708,
0.611903965473175,
0.1578807830810547,
0.34493952989578247,
1.1087367534637451,
0.08989452570676804,
0.2932339608669281,
0.7781347036361694,
-0.255436509847641,
-0.1566615253686905,
-0.51188725233078,
0.0716177299618721,
-0.02... |
func DeleteAttach(Ob map[string]interface{}, userId string) *utils.Response {
var (
attach *model.Attachment
path []interface{}
notePath string
attlist []string
)
if _, ok := Ob["Uuid"].([]interface{}); ok {
path = Ob["Uuid"].([]interface{})
} else {
return utils.WITHOUT_PARAMETERS
}
if _, ok :... | [
-0.5744479894638062,
0.11176504194736481,
1.2063584327697754,
0.4850582778453827,
-0.22986890375614166,
0.5130355954170227,
0.9161226749420166,
-0.8592585921287537,
0.17555756866931915,
0.2434181421995163,
0.06834816187620163,
0.24367393553256989,
-0.7199845910072327,
0.26542922854423523,
... |
func GetNote(Ob map[string]interface{}, userId string) *utils.Response {
var path string
var reNote utils.Note
var status uint8 = 0
if _, ok := Ob["Path"].(string); ok {
path = Ob["Path"].(string)
} else {
return utils.WITHOUT_PARAMETERS
}
if _, ok := Ob["Status"].(float64); ok {
status = uint8(Ob["Status"... | [
-0.3392247259616852,
-0.10982976853847504,
0.9916666150093079,
0.9278050065040588,
0.4961083233356476,
0.1772201955318451,
0.46130824089050293,
-0.4511781632900238,
-0.24342012405395508,
0.21394625306129456,
0.5243882536888123,
0.1787673979997635,
-0.6305672526359558,
-0.0478813536465168,
... |
func Move(Ob map[string]interface{}, userId string) *utils.Response {
var noteId, categoryId string
filed := []string{"CategoryPath", "CategoryName"}
var note *model.Note
if _, ok := Ob["Path"].(string); ok {
noteId = Ob["Path"].(string)
note = model.NewNote(noteId)
note.UID = userId
if !note.IsExist() {
... | [
-0.8118815422058105,
-0.2002752721309662,
1.2299753427505493,
0.4409874379634857,
0.19292767345905304,
0.5367384552955627,
0.8437015414237976,
-0.24611325562000275,
-0.46600261330604553,
0.49301403760910034,
-0.41691315174102783,
-0.21852780878543854,
-0.0023121978156268597,
-0.11248265206... |
func Update(Ob map[string]interface{}, userId string) *utils.Response {
var (
note *model.Note
noteId string
filed []string
attachlist []interface{}
Usn int
attachtype utils.AttchType
err error
)
if _, ok := Ob["Path"].(string); ok {
noteId = Ob["Path"].(string)
note = ... | [
-0.7824103832244873,
-0.7861132621765137,
1.0680466890335083,
-0.08077509701251984,
-0.37606316804885864,
0.8388403058052063,
-0.08276766538619995,
-0.44988980889320374,
-0.2588711678981781,
0.6927428841590881,
-0.4585145115852356,
0.1549188494682312,
-0.02291884832084179,
-0.1808483451604... |
func GetOtherNoteList(userId string) *utils.Response {
noteList := model.NewNoteList("", userId)
notes, err := noteList.GetListNoCategory()
if err != nil {
beego.Error(err)
return utils.NewResponse(utils.SYSTEM_CODE, err.Error(), nil)
}
return utils.NewResponse(0, "", convertNote(notes))
} | [
-0.6873860955238342,
-0.3648591935634613,
0.5429808497428894,
-0.1822490096092224,
-0.34425145387649536,
-0.0003723600530065596,
-0.05077055096626282,
-0.5666800737380981,
0.28963330388069153,
0.7237582802772522,
-1.2600539922714233,
0.9441448450088501,
-0.48184651136398315,
1.555209636688... |
func GetNoteID(userId string) *utils.Response {
var note model.Note
note.UID = userId
path := utils.CreateId()
note.Path = path
note.Status = model.STATUS_PRECREATE
if err := note.Create(); err != nil {
beego.Error(err)
return utils.NewResponse(utils.SYSTEM_CODE, err.Error(), nil)
}
// IncrUsn(userId)
t :=... | [
0.09869975596666336,
0.1436522752046585,
0.6738945841789246,
0.6155642867088318,
0.39944303035736084,
0.5693976879119873,
1.0708975791931152,
-0.30596956610679626,
0.7813470363616943,
-0.08497142046689987,
-0.5267093777656555,
0.7153434753417969,
-0.39203861355781555,
0.7146896123886108,
... |
func GetAllNoteList(ob map[string]interface{}, userId string) interface{} {
var (
path string
result interface{}
)
if _, ok := ob["Path"].(string); ok {
path = ob["Path"].(string)
} else {
return utils.WITHOUT_PARAMETERS
}
switch path {
case "all":
result = GetAllnote(userId)
case "recycle":
resu... | [
0.037672121077775955,
-0.580656886100769,
0.7389204502105713,
1.2051013708114624,
-0.20414431393146515,
0.08870499581098557,
-0.19964246451854706,
-0.07030221074819565,
0.03197399526834488,
0.672293484210968,
-0.09797340631484985,
0.6197719573974609,
-0.18300606310367584,
1.117065906524658... |
func AddNoteUsn(path, userId string, Usn int) {
note := model.NewNote(path)
note.UID = userId
filed := []string{"Usn"}
note.Usn = Usn
beego.Debug("inc Usn")
if err := note.Update(filed); err != nil {
beego.Error(err)
}
return
} | [
-0.26434090733528137,
-0.3212255835533142,
0.5833897590637207,
0.14538399875164032,
0.26714444160461426,
0.7477690577507019,
0.10653813183307648,
0.9988616704940796,
0.06506707519292831,
-0.5536748766899109,
-0.6157317757606506,
0.2142196148633957,
0.09225580841302872,
-0.6077276468276978,... |
func RecoverNote(Ob map[string]interface{}, userId string) *utils.Response {
var (
note *model.Note
path string
Usn int
)
filed := []string{"Status", "UpdateTime", "CategoryPath", "CategoryName", "IsPinned"}
if _, ok := Ob["Path"].(string); ok {
path = Ob["Path"].(string)
note = model.NewNote(path)
no... | [
-0.6036845445632935,
-0.16498158872127533,
1.0807551145553589,
0.3956928551197052,
0.3023490309715271,
0.15916354954242706,
0.4693804681301117,
0.40245333313941956,
0.003978871274739504,
0.17371562123298645,
-0.32091954350471497,
-0.4915219247341156,
-0.24983154237270355,
-0.12695510685443... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.