text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (*userExternalAccounts) Delete(ctx context.Context, id int32) error {
if Mocks.ExternalAccounts.Delete != nil {
return Mocks.ExternalAccounts.Delete(id)
}
res, err := dbconn.Global.ExecContext(ctx, "UPDATE user_external_accounts SET deleted_at=now() WHERE id=$1 AND deleted_at IS NULL", id)
if err != nil {
... | [
0.03711627051234245,
0.34396976232528687,
0.7575556635856628,
0.11377781629562378,
0.032920315861701965,
-0.1337123066186905,
0.4167141914367676,
0.03168869391083717,
0.39349165558815,
0.42514193058013916,
-0.23650427162647247,
0.07786379754543304,
-0.9611174464225769,
-0.02898447960615158... |
func (*userExternalAccounts) TmpMigrate(ctx context.Context, serviceType string) error {
// TEMP: Delete all external accounts associated with deleted users. Due to a bug in this
// migration code, it was possible for deleted users to be associated with non-deleted external
// accounts. This caused unexpected behavi... | [
-0.30619892477989197,
0.6510249376296997,
0.8109011650085449,
-0.01706865429878235,
-0.4479912519454956,
-0.693844199180603,
0.21772563457489014,
-0.7916843295097351,
0.3369291126728058,
-0.2829391360282898,
-0.09054790437221527,
-0.11692559719085693,
-0.4983469247817993,
1.025693655014038... |
func SetUint32(buf []byte, pos int, val uint32) {
if pos+4 > len(buf) {
return
}
for i := 0; i < 4; i++ {
buf[3-i+pos] = byte(val)
val >>= 8
}
} | [
0.4495235085487366,
0.14419518411159515,
0.3427313268184662,
-0.7310740947723389,
-0.12564128637313843,
0.558367908000946,
-0.8111869692802429,
-0.5094388723373413,
-0.5872288346290588,
-0.2162236124277115,
-1.1884034872055054,
-0.365945965051651,
0.19501033425331116,
-0.4729478359222412,
... |
func fixDesKeyByte(val byte) byte {
var newval byte = 0
for i := 0; i < 8; i++ {
newval <<= 1
newval += (val & 1)
val >>= 1
}
return newval
} | [
-0.4725930392742157,
0.3820846676826477,
0.6333118081092834,
0.49174216389656067,
-0.2594577670097351,
0.11400002986192703,
-0.02125789038836956,
0.060972392559051514,
-0.12794353067874908,
-0.21154673397541046,
-0.15228669345378876,
0.3875259757041931,
-0.6653943657875061,
0.9443268775939... |
func fixDesKey(key string) []byte {
tmp := []byte(key)
buf := make([]byte, 8)
if len(tmp) <= 8 {
copy(buf, tmp)
} else {
copy(buf, tmp[:8])
}
for i := 0; i < 8; i++ {
buf[i] = fixDesKeyByte(buf[i])
}
return buf
} | [
-0.669249415397644,
0.5611158609390259,
0.7411196827888489,
0.5696126818656921,
0.032936666160821915,
-0.31994014978408813,
-0.6218902468681335,
-0.026457130908966064,
0.16754527390003204,
0.13068711757659912,
-0.45161935687065125,
0.4797862768173218,
-0.41194483637809753,
0.77573329210281... |
func NewAddressBookQuery() *AddressBookQuery {
return &AddressBookQuery{
fileID: nil,
limit: 0,
}
} | [
-0.19459621608257294,
-0.6139642000198364,
-0.11431959271430969,
1.1277806758880615,
-1.0644850730895996,
0.25466910004615784,
-0.49003565311431885,
0.44823917746543884,
-0.6191608905792236,
-0.3499282896518707,
-0.04278365895152092,
-0.6817057132720947,
-0.4117226302623749,
1.151772022247... |
func (query *AddressBookQuery) SetFileID(id FileID) *AddressBookQuery {
query.fileID = &id
return query
} | [
0.616348385810852,
-0.39810460805892944,
0.0074914321303367615,
0.14109699428081512,
-0.5930359959602356,
1.807925820350647,
-0.16694819927215576,
0.9597687721252441,
0.3781282305717468,
-0.09082973748445511,
0.3806789815425873,
-0.14485888183116913,
-0.39596861600875854,
1.302011132240295... |
func (query *AddressBookQuery) SetLimit(limit int32) *AddressBookQuery {
query.limit = limit
return query
} | [
-0.2708706855773926,
0.35731470584869385,
0.1552804410457611,
0.10900048166513443,
-0.31823742389678955,
1.484372854232788,
0.06613258272409439,
0.12194467335939407,
0.5067998170852661,
-0.42367494106292725,
0.28239136934280396,
-0.28611987829208374,
-0.7632200717926025,
-0.251814097166061... |
func (query *AddressBookQuery) Execute(client *Client) (NodeAddressBook, error) {
var cancel func()
var ctx context.Context
var subClientError error
err := query._ValidateNetworkOnIDs(client)
if err != nil {
return NodeAddressBook{}, err
}
pb := query._Build()
messages := make([]*services.NodeAddress, 0)
... | [
-0.6631346940994263,
0.4976648688316345,
1.1797393560409546,
-0.09554725885391235,
0.23953601717948914,
-0.1593988835811615,
0.13959692418575287,
-0.5898422598838806,
-0.4638180136680603,
1.2254019975662231,
0.17293325066566467,
0.7088103294372559,
-0.5317543148994446,
-0.31303995847702026... |
func ToAPI(api *Api) *v1.Api {
crd := &v1.Api{}
crd.TypeMeta.Kind = "Api"
crd.TypeMeta.APIVersion = v1.GroupVersion.Group + "/" + v1.GroupVersion.Version
crd.ObjectMeta.Name = api.ID
crd.ObjectMeta.Namespace = api.Namespace
crd.ObjectMeta.Labels = make(map[string]string)
crd.ObjectMeta.Labels[v1.ServiceunitLabe... | [
-0.14612393081188202,
-0.9122138023376465,
0.812049388885498,
-0.43925294280052185,
0.151543527841568,
0.5115503668785095,
0.3813346326351166,
-0.23054936528205872,
-0.16833658516407013,
0.6734080910682678,
-0.08377797901630402,
0.47382092475891113,
0.05996977537870407,
-0.2512148022651672... |
func Run(args []string) error {
if len(args) == 0 {
return ErrUsage
}
switch args[0] {
case "init":
return Init()
case "new":
if len(args) != 2 {
return ErrUsage
}
return New(args[1])
case "up":
return Up()
case "down":
return Down()
}
return ErrUsage
} | [
-1.3713512420654297,
-0.6390511393547058,
0.6411539316177368,
0.39074286818504333,
-0.22094441950321198,
0.23133936524391174,
0.18379172682762146,
-0.4133661985397339,
-0.60243159532547,
0.07747757434844971,
-0.04064541310071945,
0.44012513756752014,
-1.0487476587295532,
0.2855301201343536... |
func Init() error {
if err := os.Mkdir(DirName, 0755); err != nil {
return err
}
if err := createMigration("create-migrations", InitMigrationUp, InitMigrationDown); err != nil {
return err
}
fmt.Println("mig initialized")
if err := Up(); err != nil {
return err
}
return nil
} | [
-0.22351914644241333,
0.1566668152809143,
0.7627518773078918,
0.6744304895401001,
0.5801258087158203,
0.8234716057777405,
0.41625556349754333,
0.32421350479125977,
-0.1737440675497055,
-0.39585164189338684,
-0.33007529377937317,
0.38535553216934204,
-0.6475589871406555,
0.8422572016716003,... |
func New(name string) error {
return createMigration(name, "/* Your up migration code here */", "/* Your down migration code here */")
} | [
-0.3477639853954315,
0.012923414818942547,
0.4460136890411377,
0.7425627112388611,
-0.7774999141693115,
-0.6058740615844727,
-0.30596500635147095,
-0.11454641073942184,
-1.040297269821167,
0.4292285144329071,
-0.9565123915672302,
-0.27360501885414124,
0.4139910340309143,
1.1556593179702759... |
func Up() error {
db, err := db()
if err != nil {
return err
}
vs, err := versions(db, false)
if err != nil {
return err
}
files, err := filepath.Glob(filepath.Join(DirName, "*.up.sql"))
if err != nil {
return err
}
run := []string{}
for _, f := range files {
name := filepath.Base(f[:len(f)-7])
... | [
-0.49267348647117615,
-0.24805955588817596,
1.189939022064209,
0.47874435782432556,
0.42502889037132263,
0.46306613087654114,
0.6067861914634705,
0.09134892374277115,
-0.4831126928329468,
0.9811249375343323,
0.1732291877269745,
0.08176729083061218,
-0.02132168598473072,
0.4525604844093323,... |
func Down() error {
db, err := db()
if err != nil {
return err
}
vs, err := versions(db, true)
if err != nil {
return err
}
for _, v := range vs {
fmt.Println("reverting", v)
contents, err := ioutil.ReadFile(filepath.Join(DirName, v+".down.sql"))
if err != nil {
return err
}
_, err = db.Exec(s... | [
0.5679141879081726,
-0.11684305220842361,
1.0052921772003174,
0.39162003993988037,
0.7871853113174438,
0.9134121537208557,
0.7152440547943115,
0.4649563729763031,
-0.5839906334877014,
-0.1035899743437767,
0.7336653470993042,
0.48276522755622864,
-0.577113687992096,
0.6177186965942383,
-0... |
func getNumNums() []int {
b, err := ioutil.ReadFile("input.txt")
if err != nil {
panic(err)
}
strNums := strings.Split(string(b), "\n")
var numNums []int
for _, n := range strNums {
i, err := strconv.Atoi(n)
if err != nil {
panic(err)
}
numNums = append(numNums, i)
}
return numNums
} | [
-0.06772331893444061,
-0.2587241232395172,
0.8574947714805603,
-0.03222019597887993,
0.09154706448316574,
0.3332160413265228,
0.13927222788333893,
0.869022011756897,
-0.26733383536338806,
-0.4074302613735199,
-0.7639892101287842,
0.8352363705635071,
0.13683165609836578,
0.04088088497519493... |
func SendMessages(session string, cid int, g *gocui.Gui) func(string, *string) {
client := cookie.SetCookie(session, "say")
Cid := strconv.Itoa(cid)
var reciever string
var hash string
var name string
Send := func(msg string, toName *string) {
hash = ""
name = *toName
if name[0] == '#' {
hash = "%23"
... | [
0.25416913628578186,
-0.15137119591236115,
0.7389070987701416,
-0.6357468366622925,
-0.039656322449445724,
-0.5959001183509827,
-0.30081480741500854,
-1.3452224731445312,
-0.9423314929008484,
0.371795117855072,
-0.13295499980449677,
-0.09066885709762573,
-0.9482166171073914,
0.782943606376... |
func ViewMessages(session string, reader *bufio.Reader, toName *string, g *gocui.Gui, chan2 chan string) {
var msg BufferMsg
var last string
last = ""
var t time.Time
for {
line, _ := reader.ReadBytes('\n')
if err := json.Unmarshal(line, &msg); err != nil {
fmt.Println("I found the error here")
panic(... | [
0.3074602484703064,
-0.8335586190223694,
0.8116328120231628,
-1.735901117324829,
-0.5640091896057129,
-0.32975056767463684,
-0.0023136043455451727,
-0.7684592604637146,
-0.1787932813167572,
-0.21892252564430237,
0.31158992648124695,
0.6620684266090393,
-0.7224403619766235,
0.76855599880218... |
func Solve(fname string) {
polymer := ReadInput(fname)
solution1 := Part1(polymer)
solution2 := Part2(polymer)
fmt.Printf("Part 1: %d\nPart 2: %d\n", solution1, solution2)
} | [
-0.34159889817237854,
-1.0423649549484253,
0.6510999798774719,
0.22111421823501587,
0.13989761471748352,
0.522536039352417,
0.28941938281059265,
-0.3289174735546112,
-1.5212479829788208,
-0.29706335067749023,
-0.5083784461021423,
-0.37769684195518494,
-0.5159028768539429,
-0.62339949607849... |
func Part1(polymer string) int {
return len(React(polymer))
} | [
0.1774068921804428,
-0.003111789235845208,
0.16806256771087646,
-0.5664747357368469,
-0.36632785201072693,
-0.1422169804573059,
0.26920613646507263,
1.0468250513076782,
0.49027565121650696,
0.5109917521476746,
-0.8834174275398254,
0.10846691578626633,
-1.2223694324493408,
-1.41931319236755... |
func Part2(polymer string) int {
// get a string with all of the unique letters in `polymer` (lower-cased)
letters := ""
for _, char := range polymer {
if c := unicode.ToLower(char); !strings.ContainsRune(letters, c) {
letters += string(c)
}
}
// make an int slice to hold the lengths of the reacted sub-po... | [
0.8083966374397278,
-1.010292649269104,
0.6757909655570984,
-1.0364649295806885,
-0.5968536734580994,
-0.5321895480155945,
0.01827963814139366,
0.08940622210502625,
0.35012197494506836,
-0.26150625944137573,
-0.6361401677131653,
0.6026429533958435,
-1.4881162643432617,
-0.761393666267395,
... |
func ReadInput(fname string) string {
content, err := ioutil.ReadFile(fname)
if err != nil {
log.Fatal(err)
}
polymer := strings.TrimSpace(string(content))
return polymer
} | [
0.3850029408931732,
-0.5701804161071777,
0.6861982941627502,
-0.39571359753608704,
-0.9501044154167175,
1.3519445657730103,
0.34495097398757935,
0.36871322989463806,
-0.2915025055408478,
0.35234498977661133,
0.6797005534172058,
-0.08744104951620102,
-0.5211510062217712,
-1.1694437265396118... |
func main() {
} | [
0.5935109257698059,
-0.5238813161849976,
0.06262364238500595,
1.9832351207733154,
0.3146790564060211,
0.4833202362060547,
1.6697919368743896,
0.6601263284683228,
-0.13723190128803253,
-0.6224525570869446,
-0.7590957880020142,
0.3508590757846832,
-0.36477935314178467,
0.25635138154029846,
... |
func (r *Reply) Ok() *Reply {
return r.Status(http.StatusOK)
} | [
0.4429466128349304,
-0.27990832924842834,
0.25626301765441895,
-0.7809276580810547,
-0.5321856141090393,
0.3241119682788849,
-0.327724814414978,
0.0763019472360611,
0.6167097091674805,
0.853459358215332,
-0.4762187898159027,
0.9292775988578796,
0.1328980177640915,
-0.44669532775878906,
-... |
func (r *Reply) Created() *Reply {
return r.Status(http.StatusCreated)
} | [
0.6878808736801147,
-0.5413650870323181,
0.25971582531929016,
-0.38780874013900757,
0.5664864778518677,
-0.20414912700653076,
-0.9375292062759399,
-0.15664643049240112,
0.5290195941925049,
-0.8415808081626892,
-0.6139256954193115,
0.5967350006103516,
0.586707592010498,
0.004784908145666122... |
func (r *Reply) Accepted() *Reply {
return r.Status(http.StatusAccepted)
} | [
0.5576620697975159,
-0.5902604460716248,
0.49878939986228943,
-1.4535235166549683,
-0.8585109114646912,
0.10677791386842728,
-0.4372693598270416,
0.11907167732715607,
0.6362796425819397,
-0.008674204349517822,
-0.9401602745056152,
0.5516822934150696,
0.3775186836719513,
0.06304433941841125... |
func (r *Reply) NoContent() *Reply {
return r.Status(http.StatusNoContent)
} | [
0.339695006608963,
0.07373735308647156,
-0.0417775884270668,
-1.1961297988891602,
-0.7760252952575684,
-0.17759209871292114,
0.06377093493938446,
-1.2439525127410889,
-0.628271758556366,
-0.3045090436935425,
-0.22045625746250153,
0.03440200909972191,
-0.5724425911903381,
-0.796839118003845... |
func (r *Reply) MovedPermanently() *Reply {
return r.Status(http.StatusMovedPermanently)
} | [
0.2327580600976944,
-0.8307285308837891,
0.6022335290908813,
0.01651173084974289,
-0.9529934525489807,
-0.13124153017997742,
-0.5697214603424072,
-0.26229292154312134,
0.29441359639167786,
0.2836063802242279,
-0.39898481965065,
0.5925351977348328,
-0.6650002002716064,
-0.5778111815452576,
... |
func (r *Reply) Found() *Reply {
return r.Status(http.StatusFound)
} | [
0.9648590087890625,
-1.030948281288147,
0.22293582558631897,
-1.4092388153076172,
0.36458519101142883,
0.012970794923603535,
-0.691749095916748,
-0.89044189453125,
0.604307234287262,
-0.49444273114204407,
-1.0345749855041504,
0.3242005407810211,
0.30861610174179077,
0.2911343276500702,
-... |
func (r *Reply) TemporaryRedirect() *Reply {
return r.Status(http.StatusTemporaryRedirect)
} | [
0.08386486023664474,
-0.7237725257873535,
0.49717018008232117,
-1.155808687210083,
-0.43326109647750854,
0.1484663188457489,
-0.26950210332870483,
0.010168928653001785,
1.0200875997543335,
-0.387378066778183,
-0.21097198128700256,
0.035114586353302,
-0.6776500940322876,
-0.4960071146488189... |
func (r *Reply) BadRequest() *Reply {
return r.Status(http.StatusBadRequest)
} | [
-0.21575196087360382,
-0.5269433856010437,
0.3949427008628845,
-0.5559479594230652,
0.389035165309906,
0.2128451019525528,
-1.478796124458313,
0.4514504373073578,
0.6140785217285156,
-0.6184893846511841,
0.598266065120697,
0.7774273157119751,
0.03383086994290352,
-0.31436294317245483,
-0... |
func (r *Reply) Unauthorized() *Reply {
return r.Status(http.StatusUnauthorized)
} | [
-0.4836997389793396,
-1.1540708541870117,
0.41016650199890137,
-1.0030735731124878,
-0.7706824541091919,
-0.11777543276548386,
-0.6217716336250305,
0.3281429409980774,
0.6366242170333862,
-1.165097713470459,
-0.25607916712760925,
1.4949796199798584,
-0.2411225140094757,
-0.4255862236022949... |
func (r *Reply) Forbidden() *Reply {
return r.Status(http.StatusForbidden)
} | [
0.2798638641834259,
-0.00030564345070160925,
0.4076767861843109,
-0.17189763486385345,
-0.11292911320924759,
-0.10089115053415298,
-0.5535058975219727,
-0.7757465839385986,
0.26186925172805786,
-0.7414781451225281,
-0.54644376039505,
1.1299241781234741,
-0.30190807580947876,
-1.07287573814... |
func (r *Reply) NotFound() *Reply {
return r.Status(http.StatusNotFound)
} | [
0.6230769157409668,
-0.8203770518302917,
0.07475487887859344,
-0.9406450986862183,
-0.07501622289419174,
0.2889411151409149,
-0.35762128233909607,
-0.06807872653007507,
1.5139822959899902,
-0.6158983111381531,
-0.20624062418937683,
0.8148018717765808,
-0.16708381474018097,
-0.3658903241157... |
func (r *Reply) MethodNotAllowed() *Reply {
return r.Status(http.StatusMethodNotAllowed)
} | [
0.38439255952835083,
0.13084641098976135,
0.37657445669174194,
-0.17278829216957092,
-1.0088051557540894,
-0.17881560325622559,
-0.6411596536636353,
-0.42463257908821106,
0.4283885359764099,
0.5121828317642212,
0.8001628518104553,
0.5783221125602722,
0.11436252295970917,
-0.284633964300155... |
func (r *Reply) NotAcceptable() *Reply {
return r.Status(http.StatusNotAcceptable)
} | [
0.457929790019989,
-0.22279347479343414,
0.34673386812210083,
-1.0812454223632812,
-1.2666358947753906,
0.12170803546905518,
-0.1766115427017212,
-0.27000266313552856,
-0.13023801147937775,
0.38609203696250916,
-0.03784120827913284,
0.008715830743312836,
-0.14915135502815247,
-0.2059257030... |
func (r *Reply) Conflict() *Reply {
return r.Status(http.StatusConflict)
} | [
-0.12477420270442963,
-0.4819391667842865,
0.47494494915008545,
-0.3205069303512573,
0.4157485067844391,
0.18821293115615845,
-0.30043020844459534,
-0.15689988434314728,
0.7290838360786438,
-0.26989036798477173,
0.21260955929756165,
-0.10224884748458862,
-1.2205625772476196,
-0.19047042727... |
func (r *Reply) UnsupportedMediaType() *Reply {
return r.Status(http.StatusUnsupportedMediaType)
} | [
-0.30806443095207214,
-0.2622716724872589,
0.19082215428352356,
-0.8227567672729492,
-1.5620490312576294,
-0.4320635199546814,
-0.7229738235473633,
0.6907504796981812,
0.5764740705490112,
0.7500588893890381,
-0.6822470426559448,
0.12811537086963654,
-0.6489360332489014,
0.8279246687889099,... |
func (r *Reply) ServiceUnavailable() *Reply {
return r.Status(http.StatusServiceUnavailable)
} | [
-1.1995383501052856,
-1.1920158863067627,
0.2660355567932129,
-1.0517512559890747,
0.18255938589572906,
0.2077191025018692,
-0.6199087500572205,
0.174916610121727,
0.4870319962501526,
0.24272963404655457,
-0.3364633619785309,
0.9700443148612976,
-0.49005749821662903,
0.3025958836078644,
... |
func (r *Reply) JSON(data interface{}) *Reply {
r.ContentType(ahttp.ContentTypeJSON.String())
r.Render(&jsonRender{Data: data})
return r
} | [
0.21604473888874054,
-0.6110702157020569,
0.5173164010047913,
-1.6922316551208496,
-1.0800316333770752,
-0.2724236249923706,
-0.3807939887046814,
-0.40680965781211853,
0.8756392002105713,
-0.39506950974464417,
-0.2910417318344116,
0.9948862195014954,
0.18227019906044006,
0.2993335723876953... |
func (r *Reply) JSONSecure(data interface{}) *Reply {
r.ContentType(ahttp.ContentTypeJSON.String())
r.Render(&secureJSONRender{Data: data, Prefix: r.ctx.a.settings.SecureJSONPrefix})
return r
} | [
-0.31982216238975525,
-0.2669648230075836,
0.591459333896637,
-0.7746456265449524,
-1.0622258186340332,
-1.2583019733428955,
-0.9549896717071533,
-2.1294028759002686,
0.9100350141525269,
0.1555071473121643,
-1.01898193359375,
1.0260483026504517,
0.2454397976398468,
-0.6107935309410095,
-... |
func (r *Reply) JSONP(data interface{}, callback string) *Reply {
r.ContentType(ahttp.ContentTypeJavascript.String())
r.Render(&jsonpRender{Data: data, Callback: callback})
return r
} | [
0.893217921257019,
-0.33297255635261536,
0.8698130249977112,
-0.7894735932350159,
-1.5087093114852905,
-0.13518035411834717,
-0.7061824798583984,
-0.8126347064971924,
1.5436803102493286,
0.6908955574035645,
0.49414485692977905,
0.04000885784626007,
-0.6269381046295166,
-0.21208637952804565... |
func (r *Reply) XML(data interface{}) *Reply {
r.ContentType(ahttp.ContentTypeXML.String())
r.Render(&xmlRender{Data: data})
return r
} | [
0.6973730325698853,
0.36907482147216797,
0.36547988653182983,
-0.8890668749809265,
-1.2150145769119263,
0.8469674587249756,
-1.4214897155761719,
0.2631467878818512,
1.7772217988967896,
-0.7737064361572266,
0.9220594763755798,
0.3531701862812042,
-0.13938847184181213,
-0.15596117079257965,
... |
func (r *Reply) Text(format string, values ...interface{}) *Reply {
r.ContentType(ahttp.ContentTypePlainText.String())
r.Render(&textRender{Format: format, Values: values})
return r
} | [
0.29841291904449463,
0.1408006250858307,
0.4796105921268463,
-0.8941329717636108,
-0.5103175640106201,
0.14589828252792358,
-1.170024037361145,
-0.18444906175136566,
0.993584930896759,
-0.46447086334228516,
-0.09626103192567825,
0.024763701483607292,
-0.49105390906333923,
-0.55933374166488... |
func (r *Reply) Binary(b []byte) *Reply {
return r.FromReader(bytes.NewReader(b))
} | [
0.5182739496231079,
-0.6827397346496582,
0.4326477646827698,
-0.49271684885025024,
-0.09612572938203812,
-0.1922590583562851,
-1.6511127948760986,
-0.6679329872131348,
0.7204012274742126,
-0.4297489821910858,
-0.3242986500263214,
0.5366768836975098,
-0.6443133354187012,
-0.5855019688606262... |
func (r *Reply) FromReader(reader io.Reader) *Reply {
r.Render(&binaryRender{Reader: reader})
return r
} | [
0.39924612641334534,
-0.08909112960100174,
0.4033834934234619,
-1.1237081289291382,
-1.8298890590667725,
-0.21064867079257965,
-0.5997536182403564,
-0.4368436932563782,
1.0273491144180298,
-0.4588877260684967,
-0.12998007237911224,
0.5851967930793762,
-0.45549529790878296,
0.50570762157440... |
func (r *Reply) File(file string) *Reply {
if !filepath.IsAbs(file) {
file = filepath.Join(r.ctx.a.BaseDir(), file)
}
r.gzip = util.IsGzipWorthForFile(file)
r.Render(&binaryRender{Path: file})
return r
} | [
0.8083029389381409,
0.29701492190361023,
0.37552696466445923,
-0.5355474948883057,
-0.4889982342720032,
0.6874887347221375,
0.19675534963607788,
-0.19582562148571014,
-0.0975634753704071,
-0.5509897470474243,
0.2881639301776886,
-0.19949601590633392,
-0.038353968411684036,
0.56715255975723... |
func (r *Reply) FileDownload(file, targetName string) *Reply {
r.Header(ahttp.HeaderContentDisposition, "attachment; filename="+targetName)
return r.File(file)
} | [
0.5111687779426575,
-0.26175034046173096,
0.46620962023735046,
-0.6974697709083557,
-0.4520314931869507,
-0.04549114406108856,
-0.19172745943069458,
-0.40083903074264526,
-0.5952509641647339,
-0.3382166028022766,
0.3483346402645111,
-0.2864457368850708,
0.7492617964744568,
-1.1404855251312... |
func (r *Reply) FileInline(file, targetName string) *Reply {
r.Header(ahttp.HeaderContentDisposition, "inline; filename="+targetName)
return r.File(file)
} | [
0.3453828692436218,
-0.7362045049667358,
0.5442671775817871,
-0.9789465665817261,
-0.4676128327846527,
-0.033082395792007446,
-0.4336696267127991,
0.953622043132782,
-0.7851732969284058,
-0.0926157757639885,
-0.3576098680496216,
-0.07852915674448013,
0.3140123188495636,
-1.010784387588501,... |
func (r *Reply) HTML(data Data) *Reply {
return r.HTMLlf("", "", data)
} | [
0.5822697877883911,
0.9808114171028137,
0.15473009645938873,
-1.3130600452423096,
-0.43756067752838135,
0.6325874924659729,
-1.3569097518920898,
-0.14885883033275604,
0.3622085750102997,
-0.6808254718780518,
0.3557243347167969,
0.7897284626960754,
-0.06815798580646515,
-0.3576142489910126,... |
func (r *Reply) HTMLl(layout string, data Data) *Reply {
return r.HTMLlf(layout, "", data)
} | [
1.2267576456069946,
0.6222845911979675,
0.17416904866695404,
-1.1399575471878052,
-0.7953306436538696,
0.8779199123382568,
-1.1197750568389893,
-0.3686700463294983,
1.456067442893982,
-0.7123147249221802,
-0.08813145756721497,
-0.2713588774204254,
0.2934075593948364,
-0.889444887638092,
... |
func (r *Reply) HTMLf(filename string, data Data) *Reply {
return r.HTMLlf("", filename, data)
} | [
1.027039647102356,
0.2933580279350281,
0.12217799574136734,
-1.2965208292007446,
-0.18808822333812714,
0.3893016278743744,
-0.9177987575531006,
0.34347185492515564,
-0.4626850187778473,
-0.9311394691467285,
0.2263852059841156,
0.5877475142478943,
0.07659392058849335,
-0.47315096855163574,
... |
func (r *Reply) HTMLlf(layout, filename string, data Data) *Reply {
r.ContentType(ahttp.ContentTypeHTML.String())
r.Render(&htmlRender{Layout: layout, Filename: filename, ViewArgs: data})
return r
} | [
1.467736840248108,
0.02907949686050415,
0.24154697358608246,
-1.2129484415054321,
-0.2958361804485321,
0.4879917800426483,
-1.018161654472351,
0.0855369046330452,
0.6920819878578186,
-0.7155337333679199,
0.38041913509368896,
0.05467953905463219,
0.23901864886283875,
0.009264780208468437,
... |
func (r *Reply) Redirect(redirectURL string) *Reply {
return r.RedirectWithStatus(redirectURL, http.StatusFound)
} | [
0.10627506673336029,
-0.2893005311489105,
0.3680931031703949,
-0.09551435708999634,
-0.1509048342704773,
0.4920036196708679,
0.3370792865753174,
-0.497894823551178,
1.3340224027633667,
-0.6997354626655579,
-0.40236449241638184,
0.33333805203437805,
-0.5274169445037842,
-0.6620633006095886,... |
func (r *Reply) RedirectWithStatus(redirectURL string, code int) *Reply {
r.redirect = true
r.Status(code)
r.path = redirectURL
return r
} | [
-0.26756078004837036,
-0.514618992805481,
0.37884700298309326,
-0.634676456451416,
-0.23162710666656494,
0.5840780735015869,
0.2779916822910309,
-0.3108130991458893,
1.4747217893600464,
-0.24700258672237396,
-0.9389000535011292,
0.03852785751223564,
0.2942696213722229,
-0.31091442704200745... |
func (r *Reply) Render(rdr Render) *Reply {
r.Rdr = rdr
return r
} | [
0.10519332438707352,
0.28591862320899963,
0.31053757667541504,
-1.0875746011734009,
-0.7422707080841064,
0.4266834557056427,
-0.8565887808799744,
0.12718725204467773,
1.2784870862960815,
-0.3131178319454193,
-0.8760292530059814,
-0.0020264205522835255,
-0.9336650967597961,
-0.0743655487895... |
func (r *Reply) HeaderAppend(key, value string) *Reply {
if key == ahttp.HeaderContentType {
return r.ContentType(value)
}
r.ctx.Res.Header().Add(key, value)
return r
} | [
-0.25033971667289734,
-0.600238561630249,
0.47640442848205566,
-0.05070272460579872,
-0.9703976511955261,
0.211612731218338,
-1.6632108688354492,
-0.5639111995697021,
0.7726131081581116,
0.7242289781570435,
0.32312601804733276,
0.2279622107744217,
-0.6675127148628235,
0.09407764673233032,
... |
func (r *Reply) Done() *Reply {
r.done = true
return r
} | [
0.3663022816181183,
0.5619394183158875,
0.6063980460166931,
-0.7329474687576294,
0.46678680181503296,
0.4553077816963196,
-0.07702133804559708,
-0.34559449553489685,
0.38936319947242737,
-0.4688100814819336,
-1.246168613433838,
0.7732611298561096,
-0.6273806691169739,
-0.07942909747362137,... |
func (r *Reply) Cookie(cookie *http.Cookie) *Reply {
if r.cookies == nil {
r.cookies = make([]*http.Cookie, 0)
}
r.cookies = append(r.cookies, cookie)
return r
} | [
0.16129978001117706,
0.6223716139793396,
0.5348374843597412,
-0.6987943649291992,
0.2496594488620758,
-0.2354094237089157,
-0.13277342915534973,
-0.8656720519065857,
1.3370482921600342,
0.022182978689670563,
-0.35634568333625793,
0.2620963752269745,
-0.10537458211183548,
0.3211174905300140... |
func (r *Reply) DisableGzip() *Reply {
r.gzip = false
return r
} | [
0.6262874603271484,
-0.03538146987557411,
0.07777414470911026,
0.3009518086910248,
0.03763261064887047,
1.0531929731369019,
0.23380108177661896,
-0.03180749714374542,
0.357103168964386,
0.10168279707431793,
-0.8623000383377075,
0.12027993053197861,
-2.1404693126678467,
-0.14749404788017273... |
func (r *Reply) IsContentTypeSet() bool {
return len(r.ContType) > 0
} | [
0.4879414737224579,
0.08416479825973511,
0.179684117436409,
-0.6032107472419739,
0.1491386741399765,
-0.5897161364555359,
0.09051700681447983,
-1.0857548713684082,
-0.13303297758102417,
0.9961292147636414,
-0.427581787109375,
0.6993052363395691,
-1.6259464025497437,
0.11490172147750854,
... |
func (r *Reply) Body() *bytes.Buffer {
return r.body
} | [
0.16461077332496643,
-0.02217036485671997,
0.2799655497074127,
-0.0956994816660881,
-0.12206552177667618,
0.7770413160324097,
-0.20411574840545654,
-1.6366294622421265,
1.5706895589828491,
-0.6040241122245789,
-1.0037615299224854,
0.7912088632583618,
-0.8207566142082214,
-0.033097516745328... |
func newReply(ctx *Context) *Reply {
return &Reply{
Code: http.StatusOK,
gzip: true,
ctx: ctx,
}
} | [
0.41120070219039917,
-0.4960957467556,
0.3629952073097229,
0.5102736949920654,
-0.5566728115081787,
-0.09597139060497284,
-1.3821698427200317,
-0.7649102807044983,
1.32717764377594,
-0.11573763191699982,
-0.0012286137789487839,
0.6246169805526733,
-0.28753671050071716,
-0.25485238432884216... |
func (t *textRender) Render(w io.Writer) (err error) {
if len(t.Values) > 0 {
_, err = fmt.Fprintf(w, t.Format, t.Values...)
} else {
_, err = io.WriteString(w, t.Format)
}
return
} | [
-0.41436171531677246,
-0.18958571553230286,
0.28280219435691833,
-1.0741205215454102,
0.13407492637634277,
0.06797870248556137,
-1.08257257938385,
0.21467237174510956,
-0.8942667245864868,
0.031678732484579086,
0.43404245376586914,
-0.8744341731071472,
-0.3077598214149475,
0.54764080047607... |
func (j *jsonRender) Render(w io.Writer) error {
return json.NewEncoder(w).Encode(j.Data)
} | [
-0.6135044693946838,
-0.6814712285995483,
0.16520565748214722,
-0.9475379586219788,
-0.8177416920661926,
-0.4091372489929199,
-1.2685495615005493,
-0.2613323926925659,
-0.06777814775705338,
0.23521408438682556,
-0.5573652982711792,
-0.5405701994895935,
-0.3081667721271515,
0.21310395002365... |
func (j *jsonpRender) Render(w io.Writer) error {
jsonBytes, err := json.Marshal(j.Data)
if err != nil {
return err
}
if len(j.Callback) == 0 {
_, err = w.Write(jsonBytes)
} else {
_, err = fmt.Fprintf(w, "%s(%s);", j.Callback, jsonBytes)
}
return err
} | [
-0.3703906536102295,
0.06511973589658737,
0.6167297959327698,
-0.5298488140106201,
-0.6491758227348328,
-0.4325431287288666,
-0.2871439456939697,
0.005801463034003973,
0.6062448620796204,
0.33156776428222656,
0.22419293224811554,
-0.032137203961610794,
-0.6390867829322815,
0.92227202653884... |
func (x *xmlRender) Render(w io.Writer) error {
if _, err := w.Write(xmlHeaderBytes); err != nil {
return err
}
return xml.NewEncoder(w).Encode(x.Data)
} | [
0.36224985122680664,
-0.089145228266716,
0.23809511959552765,
-0.35646381974220276,
-0.9477005004882812,
0.2837120294570923,
-1.3200181722640991,
-0.45022255182266235,
0.012047882191836834,
-0.26046812534332275,
0.09938716888427734,
-0.9547024369239807,
-0.8876731991767883,
-0.189642712473... |
func (d Data) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
tokens := []xml.Token{start}
for k, v := range d {
token := xml.StartElement{Name: xml.Name{Local: strings.Title(k)}}
tokens = append(tokens, token,
xml.CharData(fmt.Sprintf("%v", v)),
xml.EndElement{Name: token.Name})
}
tokens = ap... | [
-0.5757760405540466,
0.29812702536582947,
0.44589874148368835,
-0.47694408893585205,
-1.2473019361495972,
-0.2432851344347,
-1.0651557445526123,
0.7012945413589478,
-0.0383727103471756,
-0.05393325909972191,
0.07531020045280457,
0.36995789408683777,
0.2948192059993744,
0.5267004370689392,
... |
func (f *binaryRender) Render(w io.Writer) error {
if f.Reader != nil {
defer ess.CloseQuietly(f.Reader)
_, err := io.Copy(w, f.Reader)
return err
}
file, err := os.Open(f.Path)
if err != nil {
return err
}
defer ess.CloseQuietly(file)
fi, err := file.Stat()
if err != nil {
return err
}
if fi.IsD... | [
-0.23570844531059265,
-0.030828967690467834,
0.7265381217002869,
0.1684282273054123,
-0.055738404393196106,
0.032031647861003876,
0.8622767925262451,
-0.03582654520869255,
-0.09197576344013214,
-0.0026825680397450924,
0.5386961102485657,
-0.491577684879303,
0.07395335286855698,
0.334562182... |
func (h *htmlRender) Render(w io.Writer) error {
if h.Template == nil {
return errors.New("template is nil")
}
if h.Layout == "" {
return h.Template.Execute(w, h.ViewArgs)
}
return h.Template.ExecuteTemplate(w, h.Layout, h.ViewArgs)
} | [
-0.26109978556632996,
0.5079204440116882,
0.4613039791584015,
0.4406715929508209,
-0.08612722903490067,
-0.2877783179283142,
0.4963279366493225,
0.17517289519309998,
0.175284281373024,
-0.23853464424610138,
0.3682965636253357,
-1.2172874212265015,
-0.6279255747795105,
0.8159725069999695,
... |
func (plugin *cniNetworkPlugin) cleanupBridges(containerID string) error {
// Get the amount of combinations between an IP mask, and an iptables chain, with the specified container ID
result, err := getIPChains(containerID)
if err != nil {
return err
}
var teardownErrs []error
for _, net := range plugin.cniCon... | [
-0.03014044649899006,
-0.08820563554763794,
0.6322675347328186,
0.011464317329227924,
0.4475657641887665,
-0.16440671682357788,
0.9933905005455017,
-0.6217750310897827,
0.9274171590805054,
-0.39628541469573975,
-0.15257593989372253,
-0.9017959237098694,
-1.1649588346481323,
0.7398611903190... |
func NewLoadable[T any](loadFunc LoadFunction[T], cache CacheInterface[T]) *LoadableCache[T] {
loadable := &LoadableCache[T]{
loadFunc: loadFunc,
cache: cache,
setChannel: make(chan *loadableKeyValue[T], 10000),
setterWg: &sync.WaitGroup{},
}
loadable.setterWg.Add(1)
go loadable.setter()
return ... | [
-0.4412878751754761,
0.07545550912618637,
0.4442591071128845,
0.11457633227109909,
-1.345183253288269,
-0.8393435478210449,
-0.7034236192703247,
-0.3687518537044525,
-0.7854537963867188,
0.8183181285858154,
-0.98276287317276,
0.12999209761619568,
-0.21644802391529083,
0.26904425024986267,
... |
func (c *LoadableCache[T]) Get(ctx context.Context, key any) (T, error) {
var err error
object, err := c.cache.Get(ctx, key)
if err == nil {
return object, err
}
// Unable to find in cache, try to load it from load function
object, err = c.loadFunc(ctx, key)
if err != nil {
return object, err
}
// Then,... | [
-0.6562215685844421,
-0.22997139394283295,
0.5661764144897461,
-0.5443723797798157,
-0.41280558705329895,
-0.7405403256416321,
-1.1938632726669312,
-0.8794257640838623,
-0.5098921060562134,
0.4887847304344177,
0.17656777799129486,
1.1817747354507446,
-0.4721670150756836,
-0.331172972917556... |
func (c *LoadableCache[T]) Set(ctx context.Context, key any, object T, options ...store.Option) error {
return c.cache.Set(ctx, key, object, options...)
} | [
-0.42672863602638245,
-0.3245610296726227,
0.1751299351453781,
-0.09968626499176025,
0.09081678092479706,
0.40509817004203796,
-0.6113526225090027,
-0.5143968462944031,
-0.17086735367774963,
0.6867891550064087,
-0.6444271206855774,
0.29174014925956726,
0.1464601755142212,
-0.45796290040016... |
func (c *LoadableCache[T]) Delete(ctx context.Context, key any) error {
return c.cache.Delete(ctx, key)
} | [
-0.028401844203472137,
0.31789323687553406,
0.2354312390089035,
0.05042002722620964,
-0.29846471548080444,
0.29696035385131836,
-1.1661711931228638,
-0.2771974802017212,
-0.23462992906570435,
0.7731472849845886,
-0.16398794949054718,
0.18405357003211975,
-0.7141193747520447,
0.423544108867... |
func (c *LoadableCache[T]) Invalidate(ctx context.Context, options ...store.InvalidateOption) error {
return c.cache.Invalidate(ctx, options...)
} | [
0.04536568745970726,
0.3030660152435303,
0.2924173176288605,
0.39817869663238525,
-0.15272535383701324,
0.2785416543483734,
-0.9591548442840576,
-0.5156151056289673,
0.15506766736507416,
-0.3220311105251312,
0.18791602551937103,
0.14958332479000092,
-0.4289456009864807,
0.2130596935749054,... |
func (c *LoadableCache[T]) Clear(ctx context.Context) error {
return c.cache.Clear(ctx)
} | [
-0.39275142550468445,
0.32178255915641785,
0.06763266772031784,
-0.17881901562213898,
-0.5475270748138428,
0.957417905330658,
-1.2024866342544556,
-1.3390932083129883,
-0.08720935136079788,
0.2933916747570038,
0.13982228934764862,
0.5600769519805908,
0.45372071862220764,
0.3724150955677032... |
func (c *LoadableCache[T]) GetType() string {
return LoadableType
} | [
0.20412366092205048,
0.19765453040599823,
0.3497139811515808,
0.3829917907714844,
0.29642540216445923,
0.54552161693573,
-0.493079274892807,
-0.8013538122177124,
0.0931100994348526,
0.5210451483726501,
-0.6715155839920044,
0.2574024200439453,
-0.36557266116142273,
0.4460521638393402,
0.5... |
func Trace(baseErr error) error {
return traceToWriter(baseErr, os.Stderr)
} | [
1.0063104629516602,
-0.3132677674293518,
0.2621324360370636,
0.5441299676895142,
0.116616390645504,
-0.3443961441516876,
-0.08053812384605408,
-1.1254329681396484,
0.08452089130878448,
0.07443536818027496,
0.7755092978477478,
-0.6332489252090454,
0.3163428008556366,
0.823093593120575,
-0... |
func traceToWriter(baseErr error, writer io.Writer) error {
tracer, err := NewTracer(baseErr)
if err != nil {
return xerrors.Errorf("failed to initialize trace: %w", err)
}
err = tracer.trace(writer)
if err != nil {
return xerrors.Errorf("failed to run trace: %w", err)
}
// The default tracer does not end ... | [
0.41783973574638367,
-0.01100385095924139,
0.6046053171157837,
-0.1645067036151886,
0.6097425222396851,
-0.37908679246902466,
0.23679545521736145,
-0.999209463596344,
-0.3986191749572754,
0.6075408458709717,
-0.1680358648300171,
-0.18943344056606293,
0.23614400625228882,
0.3887119293212890... |
func (self *Block) Bytes() []byte {
return encoder.Serialize(*self)
} | [
-0.2918764650821686,
-0.3436800241470337,
0.4240238666534424,
0.1712985634803772,
0.12951888144016266,
0.17508073151111603,
-1.2510931491851807,
-0.5491939187049866,
0.36661237478256226,
-1.0129197835922241,
-1.355599045753479,
0.9931648373603821,
-0.4647035002708435,
0.8214823007583618,
... |
func BlockFromBytes(data []byte) (Block, error) {
var b Block
return b, encoder.DeserializeRaw(data, &b)
} | [
0.20293481647968292,
-0.16034047305583954,
0.21030934154987335,
-0.5277361273765564,
-1.0113325119018555,
0.012332992628216743,
-0.7656657695770264,
-0.31927475333213806,
0.9107244610786438,
-0.8174256682395935,
-0.5644176602363586,
0.0025573403108865023,
0.15461741387844086,
-0.1374384611... |
func (bc *BlockChain) Genesis() *Block {
return &bc.Blocks[0]
} | [
0.3759675920009613,
-0.051061760634183884,
0.673712968826294,
0.5116255283355713,
0.4341912269592285,
0.026968708261847496,
-0.29927098751068115,
-0.4742613732814789,
-0.8311039805412292,
-0.05381619930267334,
-0.10973979532718658,
0.9974745512008667,
-0.861778974533081,
0.2167272269725799... |
func (bc *BlockChain) SignBlock(seckey SecKey, block *Block) {
//set signature
if PubKeyHash(PubKeyFromSecKey(seckey)) != bc.Genesis().Head.PrevHash {
log.Panic("NewBlock, invalid sec key")
}
block.Sig = SignHash(block.Head.Hash(), seckey)
} | [
0.12816014885902405,
-0.0595160573720932,
0.5717610716819763,
1.4848288297653198,
0.6038475036621094,
0.6320145726203918,
-0.6024075150489807,
-0.3197254538536072,
-0.3696873188018799,
0.3633098900318146,
-0.8717661499977112,
0.14376553893089294,
-0.48717954754829407,
1.0809435844421387,
... |
func (bc *BlockChain) ApplyBlock(block Block) error {
//do time check
//do prevhash check
//check body hash
//check BkSeq
if block.Head.BkSeq != bc.Head().Head.BkSeq+1 {
return errors.New("block sequence is out of order")
}
if block.Head.PrevHash != bc.Head().Head.Hash() {
return errors.New("block PrevHash ... | [
-0.03560369834303856,
0.4086698591709137,
1.1287169456481934,
0.5557432174682617,
-0.02789268270134926,
0.252561092376709,
0.1696901172399521,
-0.06757339835166931,
0.92406165599823,
-0.3061593174934387,
-0.23339620232582092,
0.1872023493051529,
-1.1722146272659302,
1.6697038412094116,
0... |
func NewPool(eventBus *eventbus.EventBus, brokersNum, clientsPerBroker uint) *BrokerPool {
bp := new(BrokerPool)
bp.workers = make([]*Broker, 0)
bp.ConnectionsChan = make(chan wsConn, 100)
// Instantiate all brokers
for i := uint(0); i < brokersNum; i++ {
br := NewBroker(i, eventBus, clientsPerBroker, bp.Connec... | [
0.15997953712940216,
-0.10081019252538681,
0.7542763352394104,
0.6666198372840881,
-0.2991939187049866,
0.012251509353518486,
1.2141907215118408,
-0.07879365235567093,
0.12626709043979645,
0.061563096940517426,
-0.3223892152309418,
0.3573211133480072,
-1.22102952003479,
0.8210331797599792,... |
func (bp *BrokerPool) PushConn(conn *websocket.Conn) {
if conn == nil {
return
}
bp.lock.Lock()
defer bp.lock.Unlock()
if bp.ConnectionsChan != nil {
bp.ConnectionsChan <- conn
} else {
// Broker is closing, cannot manage this connection
_ = conn.Close()
}
} | [
0.27812066674232483,
-0.17297595739364624,
0.7279207110404968,
0.5572441816329956,
-0.18138498067855835,
-0.1760248988866806,
0.1584145575761795,
-0.07352031767368317,
0.2081557959318161,
0.2956591248512268,
-0.4520401656627655,
0.353166788816452,
-0.9428159594535828,
1.3614310026168823,
... |
func (bp *BrokerPool) Close() {
bp.lock.Lock()
defer bp.lock.Unlock()
// Closing the shared chan will trigger a cascading teardown procedure for
// brokers and their clients.
close(bp.ConnectionsChan)
bp.ConnectionsChan = nil
} | [
0.13469167053699493,
-0.4174566864967346,
0.4539569616317749,
-0.08268625289201736,
0.06206152215600014,
0.6198862195014954,
1.4949592351913452,
-0.5927819609642029,
-0.4419344961643219,
-0.40262696146965027,
0.07694736868143082,
0.344290167093277,
-2.2699179649353027,
0.9888327121734619,
... |
func NewMysqlManager(app *kassadin.App, config kassadin.MysqlConfig) (*MysqlManager, error) {
var readOnlyLength int
var err error
var engine *xorm.Engine
for _, instance := range config.Instances {
if instance.ReadOnly {
readOnlyLength++
}
}
mm := &MysqlManager{
Application: app,
Config: conf... | [
-0.3988155424594879,
-0.4864518642425537,
0.7279696464538574,
-0.260779470205307,
-0.9280031323432922,
-0.30952489376068115,
-1.2127050161361694,
0.27653297781944275,
0.17913243174552917,
0.35280248522758484,
-0.6789889931678772,
0.12113701552152634,
-0.6714555621147156,
1.082611083984375,... |
func (mm *MysqlManager) DB(name string) *xorm.Engine {
if engine, ok := mm.databases[name]; ok {
return engine
}
return nil
} | [
-0.3131638467311859,
0.3824465572834015,
0.37516921758651733,
0.8739039301872253,
-0.6129636764526367,
-0.4051445424556732,
-0.6596738696098328,
-0.5031255483627319,
0.13558842241764069,
0.20595449209213257,
0.04395456612110138,
0.15859165787696838,
-0.8897101879119873,
0.11903835088014603... |
func (mm *MysqlManager) R() *xorm.Engine {
if mm.readOnlyRing.Len() == 0 {
return mm.master
}
if e, ok := mm.readOnlyRing.Value.(*xorm.Engine); ok {
mm.readOnlyRing = mm.readOnlyRing.Next()
return e
}
return nil
} | [
-0.7668160200119019,
0.1722559779882431,
0.37405622005462646,
0.4803191125392914,
-0.712465226650238,
-0.2956451177597046,
-0.7744824886322021,
-0.3058831989765167,
0.014121866784989834,
0.2673981189727783,
0.6202870011329651,
0.9775403738021851,
-0.8097923994064331,
-0.11865251511335373,
... |
func (mm *MysqlManager) W() *xorm.Engine {
return mm.master
} | [
-0.6404633522033691,
-0.004511125385761261,
0.662183940410614,
0.43696171045303345,
-0.26575446128845215,
-0.14884601533412933,
0.20355385541915894,
-0.3460383117198944,
-0.468754380941391,
-0.9697085022926331,
-0.26816263794898987,
0.7244696021080017,
0.23107954859733582,
-0.1617007851600... |
func getIPAddress() string {
var validIP = false
var ip string
for validIP == false {
fmt.Scanln(&ip)
if len(ip) < 6 || !pattern.MatchString(ip) {
fmt.Print("Enter a valid address: ")
} else {
validIP = true
}
}
return ip
} | [
-0.3559005558490753,
-0.42516472935676575,
0.6746060252189636,
0.8434503674507141,
-0.7844671607017517,
-0.2313854843378067,
0.4420177638530731,
0.19321680068969727,
0.6071997880935669,
-0.6077966094017029,
0.802984356880188,
-0.36971330642700195,
-0.7498109936714172,
-1.121529459953308,
... |
func getLastOctet(s string) int {
split := strings.Split(s, ".")
lastOctet, _ := strconv.Atoi(split[len(split)-1])
return lastOctet
} | [
-0.0027300247456878424,
-0.16992729902267456,
0.727678120136261,
-1.1901386976242065,
-0.40602681040763855,
-0.9321518540382385,
0.7822204828262329,
-0.2302604466676712,
-0.2579359710216522,
0.01355680450797081,
0.3364085257053375,
-0.41578972339630127,
0.47015461325645447,
-1.164587497711... |
func checkHost(ipAddress string, suffix int, c chan string) {
_, err := net.DialTimeout("tcp", ipAddress+":80", time.Second*3)
if err == nil {
c <- strconv.Itoa(suffix) + " is up"
} else {
c <- strconv.Itoa(suffix) + " is down"
}
} | [
0.6263861060142517,
0.337980717420578,
0.677111029624939,
-0.3098006248474121,
-0.15278786420822144,
1.0041402578353882,
-0.8362798690795898,
0.6740845441818237,
-0.19043228030204773,
1.1874290704727173,
-0.13875171542167664,
0.8279879689216614,
-0.1614982932806015,
-0.32018551230430603,
... |
func checkResults(max int, c chan string) {
current := 0
for {
fmt.Print(<-c + ", ")
current++
if current == max {
fmt.Println("\n\nDone scanning, checking MACs...")
break
}
}
// execute arp -a and grap output of it
output, _ := exec.Command("arp", "-a").Output()
splitted := strings.Split(string(ou... | [
-0.04849138483405113,
0.0556284636259079,
0.7011708617210388,
-0.01839536987245083,
0.3072949945926666,
-0.27850499749183655,
-0.0611678883433342,
-0.5272383093833923,
-0.4795360863208771,
-0.4790075719356537,
0.6135575771331787,
-0.28537243604660034,
-0.28612032532691956,
0.75325798988342... |
func wait() {
var breaker string
fmt.Scanln(&breaker)
} | [
0.25748422741889954,
0.46876204013824463,
0.1766578108072281,
0.44755369424819946,
0.6859797239303589,
0.3638710677623749,
0.7039502263069153,
-0.4442247152328491,
-0.4982430338859558,
-1.3858692646026611,
-0.7832019925117493,
0.07810425758361816,
-0.21400190889835358,
0.35244134068489075,... |
func Parse(osArgs []string, version string) (*CLI, error) {
var cli CLI
parser := flags.NewParser(&cli, flags.HelpFlag)
parser.LongDescription = fmt.Sprintf(`Version %s
This updates the kubeconfig for Kubernetes OpenID Connect (OIDC) authentication.`,
version)
args, err := parser.ParseArgs(osArgs[1:])
if err !... | [
-0.07503829151391983,
0.286385715007782,
0.508883535861969,
0.11877002567052841,
-0.06865986436605453,
-0.08291631191968918,
-0.8655633926391602,
-0.4396218955516815,
-0.6557025909423828,
0.8492838144302368,
0.29643526673316956,
0.14268654584884644,
-0.9306870698928833,
-0.4047717452049255... |
func (c *CLI) ExpandKubeConfig() (string, error) {
d, err := homedir.Expand(c.KubeConfig)
if err != nil {
return "", fmt.Errorf("Could not expand %s: %s", c.KubeConfig, err)
}
return d, nil
} | [
0.1737455129623413,
1.143794059753418,
0.5896530747413635,
0.585822343826294,
-0.8537024855613708,
0.35104143619537354,
0.05152752250432968,
-0.04836468771100044,
0.09426256269216537,
0.8018267154693604,
0.2945984899997711,
0.5570743083953857,
-0.6324547529220581,
1.1991281509399414,
0.6... |
func (c *CLI) Run(ctx context.Context) error {
log.Printf("Reading %s", c.KubeConfig)
path, err := c.ExpandKubeConfig()
if err != nil {
return err
}
cfg, err := kubeconfig.Read(path)
if err != nil {
return fmt.Errorf("Could not read kubeconfig: %s", err)
}
log.Printf("Using current-context: %s", cfg.Current... | [
-0.2170497328042984,
-0.5863203406333923,
0.8232936859130859,
-0.4259888529777527,
-0.12204412370920181,
0.017847472801804543,
0.2302524596452713,
-0.14628276228904724,
0.4278053641319275,
0.6141122579574585,
-0.3517340123653412,
0.607921302318573,
-0.3254564702510834,
-0.3230573534965515,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.