text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func ReactNative(projectDir string) Builder {
return &ReactNativeBuilder{
projectDir: projectDir,
android: Android(projectDir + "/android"),
}
} | [
0.33499306440353394,
0.11910361051559448,
0.27492302656173706,
0.515785813331604,
-0.6852829456329346,
0.39115285873413086,
-0.5522075295448303,
0.3470167815685272,
0.02859400399029255,
-0.6345928311347961,
-0.1600462943315506,
0.41775259375572205,
-0.014008522033691406,
-0.355962187051773... |
func (b *ReactNativeBuilder) Build(output io.Writer, envVars []string) ([]string, error) {
var err error
err = npm(b.projectDir, output)
if err != nil {
return nil, err
}
paths, err := b.android.Build(output, envVars)
return paths, err
} | [
-0.715886116027832,
-0.478624165058136,
0.3593478798866272,
0.911142885684967,
0.18342286348342896,
-0.29198992252349854,
-0.019411899149417877,
-0.489705353975296,
-0.6579380631446838,
0.008636287413537502,
0.6742154359817505,
-0.5430628657341003,
0.176667258143425,
0.34429389238357544,
... |
func (b *ReactNativeBuilder) Name() string {
return "React Native"
} | [
0.03695816546678543,
-0.22902944684028625,
0.4373534023761749,
0.8479927778244019,
-1.0101704597473145,
0.6026835441589355,
-0.35077857971191406,
0.1632072478532791,
0.14745201170444489,
-0.11652123928070068,
-1.1677429676055908,
-0.0737408921122551,
-0.062492113560438156,
-0.0829856693744... |
func (b *ReactNativeBuilder) Dirname() string {
return b.projectDir
} | [
-0.405741810798645,
0.405698299407959,
0.09961391240358353,
0.5901062488555908,
-0.2902248799800873,
0.10773390531539917,
0.13707637786865234,
1.1766730546951294,
-0.02390173077583313,
-0.7228665947914124,
0.14272917807102203,
0.3381955027580261,
-0.2810071110725403,
-0.39805710315704346,
... |
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not foun... | [
-0.7961483001708984,
-1.2313168048858643,
0.633165180683136,
-0.6093899011611938,
-1.546921730041504,
-0.11101024597883224,
0.12971386313438416,
-1.3390334844589233,
-1.1358720064163208,
0.4855233430862427,
0.3090141713619232,
0.32495471835136414,
-0.6009681224822998,
-0.44264674186706543,... |
func MustAsset(name string) []byte {
a, err := Asset(name)
if err != nil {
panic("asset: Asset(" + name + "): " + err.Error())
}
return a
} | [
-0.012778956443071365,
0.11985661834478378,
0.4091298282146454,
-0.5268413424491882,
-0.8276715278625488,
0.4719155430793762,
-0.8186293840408325,
-1.5736604928970337,
0.16388541460037231,
0.6357062458992004,
-0.5354578495025635,
0.35693347454071045,
0.0057142809964716434,
-0.0248885955661... |
func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("Asset... | [
0.371969997882843,
-1.1052993535995483,
0.5630446076393127,
-0.922572672367096,
-1.356387734413147,
0.0033556853886693716,
0.6777529716491699,
-0.8006685972213745,
-1.2748286724090576,
0.3115358352661133,
0.2636086046695709,
0.26388120651245117,
0.0635773167014122,
-0.3988074064254761,
0... |
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
} | [
-0.7293784618377686,
-0.8460342288017273,
0.7321816682815552,
-0.39323121309280396,
-0.48951536417007446,
0.7661203145980835,
-0.5028699636459351,
-0.8655748963356018,
-0.4145073890686035,
0.8099913597106934,
0.16903363168239594,
1.163049578666687,
-0.028152840211987495,
0.0342608317732811... |
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
info, err := AssetInfo(name)
if err != nil {
return err
}
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
if err != nil {
return err
}
err = ioutil.WriteFile(_filePath(dir, name), d... | [
0.3437124192714691,
-0.3622540235519409,
0.6770355701446533,
-1.2592030763626099,
-0.006139514967799187,
-0.04453148692846298,
-0.0072639440186321735,
-0.43950510025024414,
-0.20619122684001923,
-0.2510169744491577,
0.1784360408782959,
0.13568510115146637,
-0.23627112805843353,
-0.56985116... |
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
// File
if err != nil {
return RestoreAsset(dir, name)
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, filepath.Join(name, child))
if err != nil {
return err
}
}
return nil
} | [
0.42261892557144165,
0.30020031332969666,
0.5813396573066711,
-0.20641657710075378,
-0.23828908801078796,
-0.24414615333080292,
0.5739709138870239,
-0.029911456629633904,
0.06188219040632248,
-0.43923482298851013,
0.5113736987113953,
0.3275970220565796,
-0.6125145554542542,
0.0351656526327... |
func console() {
for {
<-ConsoleUp
}
} | [
0.12951815128326416,
-0.13969773054122925,
0.4390372037887573,
0.493156373500824,
0.9859843254089355,
-0.408252090215683,
0.9417394399642944,
-0.8091090321540833,
-0.8108398914337158,
-0.38794758915901184,
-0.15348367393016815,
0.23604914546012878,
-0.06304894387722015,
0.0681549608707428,... |
func NewDNSProvider() (*DNSProvider, error) {
apiKey := os.Getenv("CLOUDXNS_API_KEY")
secretKey := os.Getenv("CLOUDXNS_SECRET_KEY")
return NewDNSProviderCredentials(apiKey, secretKey)
} | [
-0.04039101302623749,
0.8459265232086182,
0.02910078689455986,
0.34890255331993103,
-0.8507586121559143,
-0.49350541830062866,
-1.6832716464996338,
-0.4751527011394501,
0.4885452091693878,
0.5675559639930725,
-1.4302581548690796,
0.33120569586753845,
-0.00940656941384077,
0.388737708330154... |
func NewDNSProviderCredentials(apiKey, secretKey string) (*DNSProvider, error) {
if apiKey == "" || secretKey == "" {
return nil, fmt.Errorf("CloudXNS credentials missing")
}
return &DNSProvider{
apiKey: apiKey,
secretKey: secretKey,
}, nil
} | [
-0.22023998200893402,
0.9346279501914978,
-0.1679253876209259,
0.27830877900123596,
-0.6961104869842529,
-0.47294414043426514,
-1.388236403465271,
0.46403801441192627,
0.5482610464096069,
0.9392791390419006,
-0.9323227405548096,
0.32666099071502686,
-0.8630328178405762,
-0.2004852294921875... |
func (c *DNSProvider) Present(domain, token, keyAuth string) error {
fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
zoneID, err := c.getHostedZoneID(fqdn)
if err != nil {
return err
}
return c.addTxtRecord(zoneID, fqdn, value, ttl)
} | [
0.3264475166797638,
0.4982767403125763,
0.2540960907936096,
-0.5786701440811157,
-0.0027644222136586905,
0.7802786827087402,
-0.22698695957660675,
0.33472496271133423,
-0.040792062878608704,
0.8481637835502625,
0.4384464621543884,
0.24052540957927704,
-0.22325177490711212,
-0.2580933570861... |
func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
zoneID, err := c.getHostedZoneID(fqdn)
if err != nil {
return err
}
recordID, err := c.findTxtRecord(zoneID, fqdn)
if err != nil {
return err
}
return c.delTxtRecord(recordID, zoneID)
} | [
0.6714375615119934,
0.004293646663427353,
0.44040927290916443,
-0.3077089190483093,
-0.9108745455741882,
-0.021136803552508354,
0.48520100116729736,
0.4630475640296936,
0.28634151816368103,
0.39713361859321594,
-0.12774713337421417,
0.5726510286331177,
-0.33724212646484375,
0.1290629953145... |
func CreateChannelCmd(cdc *wire.Codec) *cobra.Command {
flagTo := "to"
flagCoins := "amount"
cmd := &cobra.Command{
Use: "create",
Short: "Create a new payment channel",
Long: "Create a new unidirectional payment channel from a local address to a remote address, funded with some amount of coins. These coin... | [
0.7881357669830322,
-0.6943265795707703,
0.8023640513420105,
-0.8898902535438538,
0.5646272897720337,
-0.05282149463891983,
0.29239779710769653,
0.13507862389087677,
0.08789662271738052,
0.00010256954556098208,
0.48944512009620667,
1.0705304145812988,
-0.5041114091873169,
0.532731711864471... |
func (c *Client) DeleteSubnetGroup(ctx context.Context, params *DeleteSubnetGroupInput, optFns ...func(*Options)) (*DeleteSubnetGroupOutput, error) {
if params == nil {
params = &DeleteSubnetGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteSubnetGroup", params, optFns, addOperationDeleteSubne... | [
-0.1337762475013733,
1.351176381111145,
0.5399713516235352,
0.8222091197967529,
-0.585442841053009,
0.12784917652606964,
0.05344472825527191,
-0.8688483238220215,
0.30713069438934326,
-0.6147485375404358,
-1.1302175521850586,
1.554728627204895,
-0.15327894687652588,
0.005568468011915684,
... |
func ListSources(ctx context.Context, rep repo.Repository) ([]SourceInfo, error) {
items, err := rep.FindManifests(ctx, map[string]string{
typeKey: ManifestType,
})
if err != nil {
return nil, errors.Wrap(err, "unable to find manifest entries")
}
uniq := map[SourceInfo]bool{}
for _, it := range items {
uni... | [
-0.2808193266391754,
-0.9216499328613281,
0.19650335609912872,
-1.217555284500122,
0.04771946743130684,
-0.2416866272687912,
-1.3019607067108154,
-0.29059290885925293,
0.5851852297782898,
-0.07010632753372192,
-0.09122753888368607,
0.07938019931316376,
-0.2527722418308258,
0.77826529741287... |
func ListSnapshots(ctx context.Context, rep repo.Repository, si SourceInfo) ([]*Manifest, error) {
entries, err := rep.FindManifests(ctx, sourceInfoToLabels(si))
if err != nil {
return nil, errors.Wrap(err, "unable to find manifest entries")
}
return LoadSnapshots(ctx, rep, entryIDs(entries))
} | [
-0.013515248894691467,
-0.46164923906326294,
0.25158315896987915,
-0.2138524204492569,
-0.9865131974220276,
-0.5908382534980774,
-1.2002921104431152,
-0.2153843194246292,
1.1235687732696533,
-0.15752828121185303,
-0.15740902721881866,
0.16208088397979736,
0.3156639635562897,
0.608282029628... |
func LoadSnapshot(ctx context.Context, rep repo.Repository, manifestID manifest.ID) (*Manifest, error) {
sm := &Manifest{}
em, err := rep.GetManifest(ctx, manifestID, sm)
if err != nil {
if errors.Is(err, manifest.ErrNotFound) {
return nil, ErrSnapshotNotFound
}
return nil, errors.Wrap(err, "unable to fin... | [
-0.1665804535150528,
-0.3641739785671234,
0.46812427043914795,
-0.24278581142425537,
-1.3018348217010498,
-0.6286029815673828,
-1.4139611721038818,
-0.21298687160015106,
1.2672010660171509,
-0.14173288643360138,
0.24809108674526215,
0.10591515898704529,
-0.4412180483341217,
0.1523838192224... |
func SaveSnapshot(ctx context.Context, rep repo.RepositoryWriter, man *Manifest) (manifest.ID, error) {
if man.Source.Host == "" {
return "", errors.New("missing host")
}
if man.Source.UserName == "" {
return "", errors.New("missing username")
}
if man.Source.Path == "" {
return "", errors.New("missing pat... | [
-0.9911041855812073,
-0.36759209632873535,
0.5869008898735046,
-0.5698289275169373,
-1.1750884056091309,
-0.5440187454223633,
-0.17228791117668152,
0.18657158315181732,
0.19417260587215424,
-0.14701130986213684,
-1.0298442840576172,
-0.9018415808677673,
-0.4196752607822418,
0.5349669456481... |
func LoadSnapshots(ctx context.Context, rep repo.Repository, manifestIDs []manifest.ID) ([]*Manifest, error) {
result := make([]*Manifest, len(manifestIDs))
sem := make(chan bool, loadSnapshotsConcurrency)
for i, n := range manifestIDs {
sem <- true
go func(i int, n manifest.ID) {
defer func() { <-sem }()
... | [
-0.7873722314834595,
0.11879092454910278,
0.4747912585735321,
0.13381294906139374,
-0.9079760313034058,
-0.5476897954940796,
-0.9634432196617126,
-0.2197638303041458,
0.17213034629821777,
0.12964947521686554,
-0.35311591625213623,
-0.6500471234321594,
-0.5351719856262207,
0.651947855949401... |
func ListSnapshotManifests(ctx context.Context, rep repo.Repository, src *SourceInfo, tags map[string]string) ([]manifest.ID, error) {
labels := map[string]string{
typeKey: ManifestType,
}
if src != nil {
labels = sourceInfoToLabels(*src)
}
for key, value := range tags {
labels[key] = value
}
entries, e... | [
-0.527622401714325,
-0.8733524680137634,
0.30118420720100403,
-0.6855285167694092,
-0.8485785722732544,
-0.6446266174316406,
-1.1019712686538696,
0.149185448884964,
0.8748766183853149,
-0.2318798005580902,
-0.8384250998497009,
0.16841405630111694,
0.4195241928100586,
1.2159473896026611,
... |
func FindSnapshotsByRootObjectID(ctx context.Context, rep repo.Repository, rootID object.ID) ([]*Manifest, error) {
ids, err := ListSnapshotManifests(ctx, rep, nil, nil)
if err != nil {
return nil, errors.Wrap(err, "error listing snapshot manifests")
}
manifests, err := LoadSnapshots(ctx, rep, ids)
if err != ni... | [
0.44426828622817993,
-1.3310542106628418,
0.22744373977184296,
0.5840480923652649,
-0.6222959756851196,
-0.5240318179130554,
-0.6741451025009155,
-0.8446817398071289,
1.261068344116211,
0.33611708879470825,
-0.16877973079681396,
0.7033855319023132,
-0.21662935614585876,
1.4248666763305664,... |
func UpdateSnapshot(ctx context.Context, rep repo.RepositoryWriter, m *Manifest) error {
oldID := m.ID
newID, err := SaveSnapshot(ctx, rep, m)
if err != nil {
return errors.Wrap(err, "error saving snapshot")
}
if oldID != newID {
if err := rep.DeleteManifest(ctx, oldID); err != nil {
return errors.Wrap(er... | [
-0.6663991808891296,
-0.9696087837219238,
0.4862271249294281,
-0.14014801383018494,
-0.8971205353736877,
-0.35773783922195435,
-0.4326445162296295,
0.2879025340080261,
0.8226468563079834,
0.4805184304714203,
0.15838418900966644,
-0.11420886218547821,
-0.19707094132900238,
0.282587349414825... |
func (myReader MyReader) Read(bytes []byte) (int, error) {
r := strings.NewReader(strings.Repeat("A", len(bytes)))
return r.Read(bytes)
} | [
-0.5369477272033691,
-0.4934113919734955,
0.5703854560852051,
-1.5743461847305298,
-0.7713438272476196,
-0.5596264004707336,
-0.3175152838230133,
0.6205194592475891,
0.7150927186012268,
0.04002911597490311,
0.24239130318164825,
-0.04754587635397911,
-1.2717695236206055,
0.25538375973701477... |
func VerifyPersona(assertion string, audience string) (*PersonaResponse, error) {
// See <https://developer.mozilla.org/en-US/docs/Persona/Remote_Verification_API>
res, err := http.PostForm("https://verifier.login.persona.org/verify",
url.Values{"assertion": {assertion}, "audience": {audience}})
if err != nil {
... | [
-0.7376418709754944,
-1.416392207145691,
0.5980380773544312,
0.32675641775131226,
-0.4724344313144684,
0.1934773027896881,
-0.26273682713508606,
0.2893155515193939,
0.8665430545806885,
-0.0037875419948250055,
-0.5117601752281189,
0.593350887298584,
-0.8861785531044006,
0.9325157403945923,
... |
func (h *handler) handlePersonaPOST() error {
var params struct {
Assertion string `json:"assertion"`
}
err := db.ReadJSONFromMIME(h.rq.Header, h.rq.Body, ¶ms)
if err != nil {
return err
}
origin := h.server.config.Persona.Origin
if origin == "" {
base.Warn("Can't accept Persona logins: Server URL not... | [
-0.16914770007133484,
-0.6067323684692383,
0.6864454746246338,
0.6751466989517212,
-0.0006395825184881687,
0.12432324886322021,
-0.24226690828800201,
0.5105187296867371,
0.5909735560417175,
-0.24245062470436096,
-0.46343979239463806,
-0.47405728697776794,
-0.8883240818977356,
0.14706911146... |
func latestGlobal(data [][]string) (int, error) {
var total int
for idx, row := range data {
if idx > 0 {
currentRow := row[len(row)-1]
confirmed, err := strconv.Atoi(currentRow)
if err != nil {
return 0, err
}
total += confirmed
}
}
return total, nil
} | [
0.07714459300041199,
0.0371733196079731,
0.7269585132598877,
0.008317320607602596,
0.08382513374090195,
0.11471038311719894,
0.4311998188495636,
0.18697482347488403,
-1.1141124963760376,
1.4596036672592163,
0.24321594834327698,
0.995601236820221,
-0.6509001851081848,
0.34822556376457214,
... |
func byDateGlobal(data [][]string, date string) (int, error) {
var total int
var dateColIndex int
for idx, column := range data[0] {
if date == column {
dateColIndex = idx
}
}
for idx, row := range data {
if idx > 0 {
currentRow := row[dateColIndex]
confirmed, err := strconv.Atoi(currentRow)
if... | [
0.10783292353153229,
0.19230012595653534,
0.8712158203125,
-0.2711470425128937,
-0.012912441976368427,
-0.08555544912815094,
0.8307344317436218,
0.03323153033852577,
-1.5337706804275513,
1.0687179565429688,
-0.19517192244529724,
0.9967210292816162,
-0.171677827835083,
0.8414512276649475,
... |
func latestByCountry(data [][]string, country string) (int, error) {
var total int
var countryData string
var countryEntryFound bool = false
regex, err := regexp.Compile("[^a-z]+")
if err != nil {
return 0, err
}
for idx, row := range data {
countryData = regex.ReplaceAllString(strings.ToLower(row[1]), "")
... | [
0.5888785719871521,
-0.44393977522850037,
0.976692259311676,
-0.16303850710391998,
0.09308615326881409,
-0.3971618711948395,
0.577172040939331,
0.0332583449780941,
-1.1215084791183472,
0.9801750183105469,
-0.12539638578891754,
0.3494705557823181,
-0.7343696355819702,
0.2931644320487976,
... |
func byDateCountry(data [][]string, date string, country string) (int, error) {
var total int
var dateColIndex int
var countryData string
var countryEntryFound bool = false
regex, err := regexp.Compile("[^a-z]+")
if err != nil {
return 0, err
}
for idx, column := range data[0] {
if date == column {
date... | [
0.16901475191116333,
0.03520394489169121,
1.0232956409454346,
-0.15927231311798096,
0.0765945240855217,
-0.11694387346506119,
0.8349317312240601,
-0.021365409716963768,
-1.0102345943450928,
0.8018153309822083,
0.0420924574136734,
0.5716770887374878,
-0.4190846383571625,
0.6942738890647888,... |
func NewListener(addr Addr) *Listener {
return &Listener{
NetAddr: addr,
connections: make(chan net.Conn, 10),
}
} | [
1.034301996231079,
-0.34719952940940857,
0.24625979363918304,
-1.1192435026168823,
-0.31154346466064453,
0.3280573785305023,
0.06088895723223686,
0.3715068995952606,
0.8472771048545837,
-0.07181762903928757,
-0.10582603514194489,
0.17595423758029938,
0.57459557056427,
0.6535637974739075,
... |
func (l *Listener) Accept() (net.Conn, error) {
l.RLock()
connections := l.connections
l.RUnlock()
if connections == nil {
return nil, &net.OpError{
Op: "connect",
Net: "fake",
Source: l.Addr(),
Err: fmt.Errorf("closed"),
}
}
conn, got := <-connections
if !got {
return nil, &net.Add... | [
-0.7595909237861633,
-0.46909019351005554,
0.7772912979125977,
-0.7903038263320923,
-0.43455255031585693,
0.006056508049368858,
0.29010555148124695,
-0.03977316990494728,
-0.2511906027793884,
0.09722419083118439,
0.35111919045448303,
-0.37918275594711304,
-0.9127455353736877,
0.91277116537... |
func (l *Listener) Close() error {
removeListener(l)
l.Lock()
defer l.Unlock()
if l.connections == nil {
return &net.OpError{
Op: "close",
Net: "fake",
Source: l.Addr(),
Err: fmt.Errorf("closed already"),
}
}
close(l.connections)
l.connections = nil
return nil
} | [
-0.11954576522111893,
0.38040751218795776,
0.41416341066360474,
-0.7524648308753967,
0.03293720260262489,
0.2971821129322052,
0.37382158637046814,
-0.38411223888397217,
0.09731137752532959,
-0.12392860651016235,
-0.0166835468262434,
-0.3677855432033539,
-0.74546879529953,
1.110857129096984... |
func (l *Listener) Addr() net.Addr {
return l.NetAddr
} | [
0.8053880333900452,
-1.112857460975647,
0.20652642846107483,
-0.043138377368450165,
-0.4916953444480896,
1.3513035774230957,
-0.0805412158370018,
-0.12132006138563156,
0.9530130624771118,
-1.0216968059539795,
1.1346418857574463,
-0.049513135105371475,
0.1180744618177414,
1.187389850616455,... |
func (c *Commands) GetHelp() []Help {
help := make([]Help, 0)
for _, command := range c.Commands {
help = append(help, command.GetHelp()...)
}
return help
} | [
0.4280185401439667,
0.2559581995010376,
0.520638644695282,
1.662998914718628,
1.389849066734314,
0.08996281772851944,
0.23508435487747192,
-0.862973153591156,
0.12958675622940063,
-0.29165828227996826,
-0.1195879653096199,
0.514456570148468,
0.13260124623775482,
1.1009265184402466,
0.754... |
func uncompressReaderData(compression string, in io.ReadCloser, estsize int64) ([]byte, error) {
var err error
var data []byte
switch compression {
case "":
tlog := dvid.NewTimeLog()
data, err = ioutil.ReadAll(in)
if err != nil {
return nil, err
}
tlog.Debugf("read 3d uncompressed POST")
case "lz4":
... | [
-0.32409530878067017,
-0.7758070826530457,
0.9704660177230835,
0.2432619333267212,
-0.8882643580436707,
0.11817679554224014,
-0.41248491406440735,
0.03882888704538345,
-0.2821180820465088,
0.23725970089435577,
0.3549345135688782,
0.02826705202460289,
-1.2539681196212769,
-0.063533276319503... |
func compressGoogle(data []byte, subvol *dvid.Subvolume) ([]byte, error) {
// TODO: share table between blocks
subvolsizes := subvol.Size()
// must <= 32
BLKSIZE := int32(8)
xsize := subvolsizes.Value(0)
ysize := subvolsizes.Value(1)
zsize := subvolsizes.Value(2)
gx := subvolsizes.Value(0) / BLKSIZE
gy := su... | [
0.2165699452161789,
0.6436069011688232,
0.9574295878410339,
-0.29387879371643066,
-0.2649977207183838,
-0.4217342734336853,
0.11361628025770187,
-0.2193232774734497,
-0.27283376455307007,
0.5803266167640686,
-0.46168312430381775,
0.28619077801704407,
-0.7880889177322388,
0.4620494842529297... |
func writeCompressedToHTTP(compression string, data []byte, subvol *dvid.Subvolume, w http.ResponseWriter) error {
var err error
w.Header().Set("Content-type", "application/octet-stream")
switch compression {
case "":
_, err = w.Write(data)
if err != nil {
return err
}
case "lz4":
compressed := make([]b... | [
-0.5816417336463928,
-0.13014797866344452,
0.9594672322273254,
0.8331335186958313,
0.2693901062011719,
0.11570784449577332,
0.6235655546188354,
-1.0988163948059082,
-0.37341931462287903,
0.21638478338718414,
0.09124421328306198,
-0.1610124111175537,
-0.25546202063560486,
0.5896565914154053... |
func (f *SAMHTTPProxy) Base32Readable() string {
b32 := strings.Replace(f.Base32(), ".b32.i2p", "", 1)
rhash, _ := f.Hasher.Friendly(b32)
return rhash + " " + strconv.Itoa(len(b32))
} | [
1.0781710147857666,
-0.4672236442565918,
0.7288960814476013,
-1.2832319736480713,
-0.5223731398582458,
1.0514142513275146,
-0.8771694898605347,
-0.39565762877464294,
-1.1426830291748047,
0.7296152710914612,
0.25885626673698425,
-0.13224473595619202,
-0.9425713419914246,
-1.435637354850769,... |
func (p *SAMHTTPProxy) samaddr() string {
return fmt.Sprintf("%s:%s", p.Conf.SamHost, p.Conf.SamPort)
} | [
0.007870068773627281,
-1.0937163829803467,
0.5667150616645813,
-0.7914597392082214,
-0.7321036458015442,
0.9672262668609619,
-0.49297791719436646,
0.3646618127822876,
0.4969797432422638,
-0.13689729571342468,
1.214909553527832,
0.3568862974643707,
-0.36555352807044983,
0.31856149435043335,... |
func (p *SAMHTTPProxy) SetupProxy() {
SetupProxy(p.Target())
} | [
-0.04376685991883278,
-0.243485227227211,
0.3499048948287964,
0.04539307579398155,
0.17519335448741913,
-0.38142457604408264,
0.17497675120830536,
0.36217376589775085,
0.48249873518943787,
-0.05417923629283905,
0.7362722754478455,
-0.013624617829918861,
-0.2834080457687378,
0.8603920936584... |
func SetupProxy(addr string) {
os.Setenv("http_proxy", "http://"+addr)
os.Setenv("https_proxy", "http://"+addr)
os.Setenv("ftp_proxy", "http://"+addr)
os.Setenv("all_proxy", "http://"+addr)
os.Setenv("HTTP_PROXY", "http://"+addr)
os.Setenv("HTTPS_PROXY", "http://"+addr)
os.Setenv("FTP_PROXY", "http://"+addr)
os... | [
-0.23305518925189972,
0.004809270147234201,
0.7849082946777344,
-0.948634922504425,
0.026271672919392586,
0.45950666069984436,
-0.15290585160255432,
0.5940341949462891,
-0.2734273672103882,
0.2814676761627197,
0.12638524174690247,
0.358256071805954,
-0.10310571640729904,
1.0170079469680786... |
func UnProxyLocal(additionalAddresses []string) {
add := ""
for _, v := range additionalAddresses {
add += "," + v
}
os.Setenv("no_proxy", "127.0.0.1,localhost"+add)
os.Setenv("NO_PROXY", "127.0.0.1,localhost"+add)
} | [
-0.06909190118312836,
-0.34751588106155396,
0.5464781522750854,
-1.5759472846984863,
-0.14643363654613495,
-0.15756002068519592,
0.2657517194747925,
1.8252220153808594,
-0.38743072748184204,
0.5159794688224792,
0.2547439634799957,
0.3553949296474457,
-0.4934341311454773,
0.0244026258587837... |
func (m *UserModel) NewUser(username, email string, passHash []byte, foreignUser bool, foreignUserID, foreignWebsite string) (int64, error) {
// Username is unique, so will fail if user already exists
var res *sql.Row
var err error
// FIXME: I've never noticed an issue here... but this RETURNING clause looks funky... | [
-0.5589295029640198,
0.5979111790657043,
0.9221724271774292,
1.144175410270691,
0.27405649423599243,
0.1121429055929184,
1.0058480501174927,
-0.0013494224986061454,
0.0919254869222641,
0.021297356113791466,
-0.02836681716144085,
-1.3886529207229614,
-1.3587476015090942,
0.34351325035095215... |
func (m *UserModel) GetForeignUser(foreignUserID string, foreignWebsite string) (int64, error) {
sql := "SELECT id FROM users WHERE foreign_user_ID=$1 AND foreign_website=$2"
row := m.Conn.QueryRow(sql, foreignUserID, foreignWebsite)
var userID int64
err := row.Scan(&userID)
switch {
case err == dbsql.ErrNoRow... | [
-0.04851863905787468,
0.6585491895675659,
0.8232125043869019,
0.8523921370506287,
0.34886762499809265,
-0.2974817454814911,
1.1920188665390015,
-0.39278778433799744,
-0.21360473334789276,
-0.2648388147354126,
0.31466910243034363,
-0.2915306091308594,
-1.236974835395813,
1.1549904346466064,... |
func TestMain(m *testing.M) {
setUp()
retCode := m.Run()
tearDown()
os.Exit(retCode)
} | [
-0.08639048784971237,
-0.17570456862449646,
0.34224942326545715,
0.9012033343315125,
0.07993212342262268,
0.8996411561965942,
1.4293779134750366,
0.390367329120636,
0.0940852016210556,
0.16741836071014404,
0.33190709352493286,
-0.04969597980380058,
-1.538055419921875,
-0.22328412532806396,... |
func setUp() {
configuration.LoggingInit(ioutil.Discard, os.Stdout, os.Stdout, os.Stderr)
smoothingCreator = NewSmoothingCreator(
1000,
4,
)
} | [
0.8583183288574219,
0.5575373768806458,
0.35848790407180786,
0.3272390365600586,
0.36598584055900574,
0.087485171854496,
0.4458177983760834,
-0.15604469180107117,
-0.43930521607398987,
-0.2908697724342346,
-0.6178902983665466,
0.40654730796813965,
0.22716444730758667,
1.150827169418335,
... |
func tearDown() {
} | [
1.163749098777771,
-0.43312549591064453,
0.0900178849697113,
0.5603580474853516,
0.1549500674009323,
0.7949403524398804,
2.0574851036071777,
0.34589168429374695,
0.8243420124053955,
-0.45523601770401,
-0.46061599254608154,
0.5907864570617676,
-0.6796217560768127,
0.1360531598329544,
-0.2... |
func TestPredictionCreatorSmoothData1(t *testing.T) {
t.Log("Initialisation of prediction configuration and data slice ...")
smoothingCreator.smoothingRange = 5000
var dataSlice [](*model.Data)
dataEntries := 18
runningTime := time.Now()
runningBytes := 10
for i:=0; i<dataEntries; i++ {
dataSlice = append(data... | [
-0.1419685035943985,
0.16302824020385742,
0.6626648306846619,
0.22284762561321259,
0.26894184947013855,
1.1446855068206787,
0.8453519344329834,
-0.06894093006849289,
-0.4382358491420746,
-0.10542416572570801,
-0.8407765626907349,
1.008021593093872,
-0.17333774268627167,
0.6201872825622559,... |
func TestPredictionCreatorSmoothData2(t *testing.T) {
t.Log("Initialisation of prediction configuration and data slice ...")
smoothingCreator.smoothingRange = 1000
var dataSlice [](*model.Data)
dataEntries := 3
runningTime := time.Now()
runningBytes := 10
for i:=0; i<dataEntries; i++ {
dataSlice = append(dataS... | [
0.07857175916433334,
0.2693588435649872,
0.613638699054718,
0.33759111166000366,
0.04327675327658653,
1.2457195520401,
0.6305861473083496,
-0.0453401543200016,
-0.5875177383422852,
-0.31590941548347473,
-0.8415778875350952,
1.1864348649978638,
-0.1046731173992157,
0.7437122464179993,
0.4... |
func TestPredictionCreatorSmoothData3(t *testing.T) {
t.Log("Initialisation of prediction configuration and data slice ...")
smoothingCreator.smoothingRange = 1000
var dataSlice [](*model.Data)
dataEntries := 10
runningTime := time.Now()
runningBytes := 10
for i:=0; i<dataEntries; i++ {
dataSlice = append(data... | [
0.06308335065841675,
0.39954671263694763,
0.6162600517272949,
0.16398297250270844,
0.20136281847953796,
1.2149608135223389,
0.6082528233528137,
0.012359127402305603,
-0.33954930305480957,
-0.17309194803237915,
-0.8272891044616699,
1.0505889654159546,
-0.24663454294204712,
0.638725042343139... |
func TestPredictionCreatorSmoothData4(t *testing.T) {
t.Log("Initialisation of prediction configuration and data slice ...")
smoothingCreator.smoothingRange = 1000
var dataSlice [](*model.Data)
dataEntries := 4
runningTime := time.Now()
runningBytes := 10
for i:=0; i<dataEntries; i++ {
dataSlice = append(dataS... | [
0.11246035248041153,
-0.021566377952694893,
0.7560802102088928,
0.27550145983695984,
0.14203158020973206,
1.0567635297775269,
1.031226634979248,
-0.32521674036979675,
-0.5902966856956482,
-0.3081362247467041,
-0.8349423408508301,
0.9274380207061768,
-0.45399463176727295,
0.7560045719146729... |
func (TransferType) EnumDescriptor() ([]byte, []int) {
return file_yandex_cloud_datatransfer_v1_transfer_proto_rawDescGZIP(), []int{0}
} | [
-0.056385599076747894,
0.7372648119926453,
0.6729613542556763,
-0.4404807686805725,
0.9334691762924194,
-0.06777364015579224,
0.4094291925430298,
-0.3747328519821167,
0.5651310682296753,
0.3615436553955078,
-0.19958782196044922,
0.4588248133659363,
-0.18326546251773834,
1.4573614597320557,... |
func (TransferStatus) EnumDescriptor() ([]byte, []int) {
return file_yandex_cloud_datatransfer_v1_transfer_proto_rawDescGZIP(), []int{1}
} | [
0.08016146719455719,
0.41390135884284973,
0.5424181818962097,
-0.8597920536994934,
0.2566576600074768,
0.08334864675998688,
-0.12182367593050003,
-0.1136341392993927,
0.5902146100997925,
-0.3948245644569397,
-0.7041685581207275,
0.5854312181472778,
0.3381846845149994,
1.1213408708572388,
... |
func (*Transfer) Descriptor() ([]byte, []int) {
return file_yandex_cloud_datatransfer_v1_transfer_proto_rawDescGZIP(), []int{0}
} | [
-0.802459716796875,
0.3899627923965454,
0.6397178769111633,
0.15845362842082977,
-0.013337455689907074,
0.5080219507217407,
0.2168569564819336,
-0.13566483557224274,
-0.17699024081230164,
-1.030650019645691,
-0.8705712556838989,
0.48472222685813904,
0.13265402615070343,
0.6927629709243774,... |
func loginPageHandler(w http.ResponseWriter, r *http.Request) {
t := template.Must(template.ParseFiles("static/template/login.html"))
s := struct {
Providers []idp.Provider
Page string
}{idp.Providers(), r.URL.Query().Get("page")}
t.Execute(w, s)
} | [
-1.1920709609985352,
0.20766277611255646,
0.5170162916183472,
-0.5349647402763367,
-0.034059956669807434,
0.45165908336639404,
-0.2920162081718445,
0.5462257266044617,
0.3251350224018097,
1.2091457843780518,
0.12474551051855087,
-0.8081676363945007,
-1.0193692445755005,
-0.7609460353851318... |
func loginRedirectHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
provider, err := strconv.Atoi(vars["provider"])
if err != nil {
http.Error(w, "Invalid identity provider", http.StatusInternalServerError)
return
} else {
idp.Authenticate(provider, w, r)
}
} | [
-1.5363191366195679,
-0.18382972478866577,
0.5786126852035522,
0.09337237477302551,
-0.9254462122917175,
1.3042391538619995,
0.07322709262371063,
-0.3105280101299286,
1.4686757326126099,
0.37993156909942627,
-0.073054239153862,
0.3633410334587097,
-1.1134380102157593,
-0.8526142239570618,
... |
func callbackHandler(w http.ResponseWriter, r *http.Request) {
// Process identity provider callback, checking tokens, etc.
auth, err := idp.Callback(w, r)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
// Store session authentication information in cookie
setCookie(w, r, auth, a... | [
-0.2305244654417038,
-0.44781070947647095,
0.5403558611869812,
0.15943951904773712,
-0.448178231716156,
0.45569169521331787,
0.7690731287002563,
-0.09167909622192383,
1.684329628944397,
0.9500070214271545,
0.4624583125114441,
-0.35581398010253906,
-0.39658939838409424,
-0.6311100721359253,... |
func authenticated(f authenticatedHandler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var a idp.Auth
err := getCookie(r, &a)
if (err != nil) || (a.IDToken == "") {
url := "/login?page=" + url.QueryEscape(r.URL.String())
http.Redirect(w, r, url, http.StatusFound)
} else {
... | [
-0.5114555358886719,
-0.5384026765823364,
0.48906177282333374,
0.3806803524494171,
-0.09725305438041687,
0.2002677172422409,
-0.0016952342120930552,
-0.10011235624551773,
0.8548091053962708,
0.05728457123041153,
-0.24843677878379822,
0.07154691219329834,
0.7224958539009094,
-0.553734183311... |
func queryPageHandler(w http.ResponseWriter, r *http.Request, a *idp.Auth) {
t := template.Must(template.ParseFiles("static/template/query.html"))
url := "ws://" + host + ":" + strconv.Itoa(port) + "/ws"
s := struct {
Name string
URL string
Timeout int
Count int
}{a.Name, url, timeout, beacon.Count... | [
-0.13362526893615723,
0.5945276618003845,
0.46083521842956543,
-0.3845002353191376,
-0.2051301747560501,
0.5735079050064087,
0.24911755323410034,
-0.2574157416820526,
-0.3290780484676361,
0.7302402257919312,
0.685228168964386,
-1.0773776769638062,
-1.0413610935211182,
-0.05169213190674782,... |
func queryAsyncHandler(w http.ResponseWriter, r *http.Request, a *idp.Auth) {
num := beacon.Count()
ch := make(chan beacon.BeaconResponse, num)
conn, err := upgrader.Upgrade(w, r, nil)
if err != nil {
return
}
_, msg, err := conn.ReadMessage()
if err != nil {
return
}
query := make(map[string][]string)
... | [
-0.29072389006614685,
-0.28354573249816895,
0.5468124151229858,
-0.31620070338249207,
-0.08887442946434021,
-0.23247407376766205,
0.5332705974578857,
-1.215506911277771,
0.5586512088775635,
0.7189222574234009,
0.36380940675735474,
-0.24176235496997833,
-0.38720986247062683,
0.7574316263198... |
func (s *Scraper) ScrapeArticle(r io.Reader) error {
doc, err := html.Parse(r)
if err != nil {
return err
}
//first find body and head
head := findFirst(doc, atom.Head)
if head == nil {
return errors.New("Could not find a head tag, perhaps this is invalid html")
}
body := findFirst(doc, atom.Body)
if body... | [
-0.2222575843334198,
-0.653275191783905,
0.9538277387619019,
-0.03682151436805725,
-0.31337112188339233,
-0.1378587782382965,
0.11045894026756287,
-0.3039000332355499,
-0.629624605178833,
0.3054325580596924,
0.21337635815143585,
-0.6707241535186768,
-0.014559977687895298,
0.129344463348388... |
func (r Range) Check(param string) (int, bool) {
if isBlank(param) {
return 0, true
}
v, err := strconv.Atoi(param)
return v, err == nil && !(v < r.Min) && !(v > r.Max)
} | [
-1.1047741174697876,
-0.13506262004375458,
0.8097097277641296,
0.09807752072811127,
0.09275638312101364,
0.12093212455511093,
-0.035661276429891586,
-0.09295394271612167,
-0.3452882170677185,
0.4033742845058441,
-0.5918092131614685,
0.41887474060058594,
-0.643072783946991,
0.83595913648605... |
func (r Range) Validate(param string) bool {
_, ok := r.Check(param)
return ok
} | [
-0.9629862308502197,
0.11401006579399109,
0.37254393100738525,
0.3328581750392914,
-0.0420767217874527,
0.569346010684967,
0.4134003818035126,
-0.8049160838127136,
-0.7106101512908936,
0.2995122969150543,
0.016677502542734146,
-0.6169179677963257,
-1.248230218887329,
0.0978175550699234,
... |
func IsClusterRoleExist(client kubeclient.Interface, name string) (bool, error) {
_, err := client.RbacV1().ClusterRoles().Get(context.TODO(), name, metav1.GetOptions{})
if err != nil {
if apierrors.IsNotFound(err) {
return false, nil
}
return false, err
}
return true, nil
} | [
-0.278354287147522,
0.06209990382194519,
0.6993946433067322,
-0.6151259541511536,
0.46900877356529236,
0.3831111490726471,
-0.5107746124267578,
-0.6330680847167969,
-0.38087424635887146,
2.0057473182678223,
-0.2797715365886688,
0.3727841079235077,
-1.345664620399475,
0.4211537539958954,
... |
func CreateClusterRole(client kubeclient.Interface, clusterRoleObj *rbacv1.ClusterRole) (*rbacv1.ClusterRole, error) {
createdObj, err := client.RbacV1().ClusterRoles().Create(context.TODO(), clusterRoleObj, metav1.CreateOptions{})
if err != nil {
if apierrors.IsAlreadyExists(err) {
return clusterRoleObj, nil
... | [
0.10230038315057755,
-0.094526506960392,
0.28622156381607056,
0.033032435923814774,
0.2049579620361328,
0.4907858073711395,
-0.32207754254341125,
-1.2561243772506714,
0.02670351415872574,
0.8656545281410217,
-0.4530743658542633,
0.3614259958267212,
-1.3233996629714966,
0.44346681237220764,... |
func DeleteClusterRole(client kubeclient.Interface, name string) error {
err := client.RbacV1().ClusterRoles().Delete(context.TODO(), name, metav1.DeleteOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return err
}
return nil
} | [
0.16019806265830994,
0.2980620563030243,
0.10003229975700378,
0.19156472384929657,
0.0714171901345253,
0.2984166145324707,
-0.24034157395362854,
-0.1375226229429245,
-0.21272625029087067,
0.9130215644836426,
-0.4717208743095398,
0.5621683597564697,
-1.2852110862731934,
0.5329036712646484,
... |
func IsClusterRoleBindingExist(client kubeclient.Interface, name string) (bool, error) {
_, err := client.RbacV1().ClusterRoleBindings().Get(context.TODO(), name, metav1.GetOptions{})
if err != nil {
if apierrors.IsNotFound(err) {
return false, nil
}
return false, err
}
return true, nil
} | [
-0.597949206829071,
0.29396089911460876,
0.8983315825462341,
0.08502992242574692,
0.2095988690853119,
0.4355950355529785,
0.23039057850837708,
-0.34693410992622375,
-0.05615897849202156,
2.1916756629943848,
-0.6147471070289612,
0.07691612094640732,
-1.3005586862564087,
0.481071412563324,
... |
func CreateClusterRoleBinding(client kubeclient.Interface, clusterRoleBindingObj *rbacv1.ClusterRoleBinding) (*rbacv1.ClusterRoleBinding, error) {
createdObj, err := client.RbacV1().ClusterRoleBindings().Create(context.TODO(), clusterRoleBindingObj, metav1.CreateOptions{})
if err != nil {
if apierrors.IsAlreadyExis... | [
-0.6327544450759888,
0.27258026599884033,
0.3163307011127472,
0.3505402207374573,
-0.07349847257137299,
0.6639684438705444,
0.21331886947155,
-0.8728232383728027,
0.8393154144287109,
0.8452854752540588,
-0.9409680366516113,
0.346362441778183,
-1.4684432744979858,
0.3724353611469269,
0.89... |
func DeleteClusterRoleBinding(client kubeclient.Interface, name string) error {
err := client.RbacV1().ClusterRoleBindings().Delete(context.TODO(), name, metav1.DeleteOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return err
}
return nil
} | [
-0.1179710254073143,
0.3956446945667267,
0.25176411867141724,
0.7406633496284485,
-0.25531241297721863,
0.46726059913635254,
0.5043084025382996,
0.16329117119312286,
0.40024566650390625,
0.8957500457763672,
-0.9008967876434326,
0.2985408902168274,
-1.2265537977218628,
0.47540417313575745,
... |
func PolicyRuleAPIGroupMatches(rule *rbacv1.PolicyRule, requestedGroup string) bool {
for _, ruleGroup := range rule.APIGroups {
if ruleGroup == rbacv1.APIGroupAll {
return true
}
if ruleGroup == requestedGroup {
return true
}
}
return false
} | [
-0.6631813049316406,
-0.4144326150417328,
0.2598946690559387,
-0.31597208976745605,
-0.008005084469914436,
0.4903739392757416,
-1.2594609260559082,
0.7217124104499817,
-0.06687584519386292,
0.18763145804405212,
0.7957494854927063,
0.5183054804801941,
-1.6195868253707886,
0.4316671788692474... |
func PolicyRuleResourceMatches(rule *rbacv1.PolicyRule, requestedResource string) bool {
for _, ruleResource := range rule.Resources {
if ruleResource == rbacv1.ResourceAll {
return true
}
if ruleResource == requestedResource {
return true
}
}
return false
} | [
0.041224751621484756,
-1.302208662033081,
0.2922879457473755,
-0.0455697737634182,
0.05417229235172272,
1.0503828525543213,
-1.1223496198654175,
0.7450843453407288,
0.4022634029388428,
0.054141927510499954,
0.9070313572883606,
0.3551097512245178,
-0.5771819949150085,
0.44494879245758057,
... |
func PolicyRuleResourceNameMatches(rule *rbacv1.PolicyRule, requestedName string) bool {
if len(rule.ResourceNames) == 0 {
return true
}
for _, resourceName := range rule.ResourceNames {
if resourceName == requestedName {
return true
}
}
return false
} | [
-0.3441970646381378,
-0.8013598918914795,
0.21970698237419128,
-0.2604268789291382,
0.06794778257608414,
0.8561376333236694,
-1.116004467010498,
0.4651123285293579,
0.28190454840660095,
0.32944971323013306,
0.5611326694488525,
-0.08488786220550537,
-0.5799587368965149,
0.6155625581741333,
... |
func GenerateImpersonationRules(subjects []rbacv1.Subject) []rbacv1.PolicyRule {
if len(subjects) == 0 {
return nil
}
users, serviceAccounts, groups := sets.NewString(), sets.NewString(), sets.NewString()
for _, subject := range subjects {
switch subject.Kind {
case rbacv1.UserKind:
users.Insert(subject.N... | [
0.14873096346855164,
0.12657733261585236,
0.5640822052955627,
-0.5358584523200989,
0.005370253697037697,
1.2520328760147095,
-0.42722615599632263,
-0.014486863277852535,
0.05529119446873665,
0.892892599105835,
0.25085827708244324,
0.7946344017982483,
-0.9182735085487366,
0.7398338913917542... |
func New(reader Reader, ctx context.Context) *Handler {
return &Handler{
reader: reader,
}
} | [
-0.12693321704864502,
-1.6273627281188965,
-0.11293619871139526,
-0.5137941241264343,
-0.9276083707809448,
0.5032988786697388,
-0.5276042819023132,
0.44126754999160767,
-0.3278719186782837,
-0.960515558719635,
0.5775582194328308,
0.25918659567832947,
0.57584148645401,
-0.6994596123695374,
... |
func (h *Handler) All(e *emptypb.Empty, s protobufs.HackerNews_AllServer) error {
items, err := h.reader.GetAllItems(s.Context())
if err != nil {
return fmt.Errorf("getAllItems: %w", err)
}
for _, item := range items {
s.Send(grpc.ToProto(item))
}
return nil
} | [
0.010094196535646915,
-0.22261027991771698,
0.5005929470062256,
0.1842944324016571,
0.9995098114013672,
0.9669236540794373,
-0.5485463738441467,
0.5960414409637451,
-0.6603250503540039,
-0.48473280668258667,
-0.4869598150253296,
0.8938236236572266,
-0.5135701894760132,
0.7663901448249817,
... |
func (h *Handler) Stories(e *emptypb.Empty, s protobufs.HackerNews_StoriesServer) error {
items, err := h.reader.GetStories(s.Context())
if err != nil {
return fmt.Errorf("getStories: %w", err)
}
for _, item := range items {
s.Send(grpc.ToProto(item))
}
return nil
} | [
0.10896719247102737,
0.6338177919387817,
0.3164340853691101,
0.16913653910160065,
1.2015950679779053,
0.7312291264533997,
-0.013916775584220886,
-0.11629146337509155,
-0.95362389087677,
-1.005861759185791,
-0.34657177329063416,
-0.1270289272069931,
-0.11873743683099747,
0.7019304633140564,... |
func (h *Handler) Jobs(e *emptypb.Empty, s protobufs.HackerNews_JobsServer) error {
items, err := h.reader.GetJobs(s.Context())
if err != nil {
return fmt.Errorf("getJobs: %w", err)
}
for _, item := range items {
s.Send(grpc.ToProto(item))
}
return nil
} | [
-0.8400431275367737,
0.6999295353889465,
0.4232582151889801,
-0.4582037925720215,
0.7398804426193237,
0.5407567620277405,
-0.4415595829486847,
0.0482410229742527,
-0.8409081697463989,
-0.9841148257255554,
-0.5567022562026978,
0.33965909481048584,
-0.9832698702812195,
0.20866136252880096,
... |
func findMissingNumber(values []int) []int {
n := 1
var missing []int
// Assuming the array is sorted
for i := range values {
if values[i] == n {
n++
} else {
missing = append(missing, n)
return missing
}
}
return missing
} | [
-0.5899131298065186,
-0.8278378248214722,
0.7717238664627075,
0.9268959760665894,
0.11881037056446075,
-0.0694298967719078,
0.41448190808296204,
-0.30245518684387207,
0.29300305247306824,
0.1032305434346199,
-0.4995133876800537,
-0.015453726053237915,
0.06875992566347122,
2.309150695800781... |
func NewSubnetNatGatewayAssociation(ctx *pulumi.Context,
name string, args *SubnetNatGatewayAssociationArgs, opts ...pulumi.ResourceOption) (*SubnetNatGatewayAssociation, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.NatGatewayId == nil {
return nil, error... | [
0.12174880504608154,
0.3734271824359894,
0.016590313985943794,
-0.2187955379486084,
-0.2823464870452881,
0.2529553174972534,
-0.5407398343086243,
-0.40634429454803467,
-0.39814576506614685,
0.42624861001968384,
-0.36937886476516724,
0.02818782813847065,
0.054612964391708374,
0.318940192461... |
func GetSubnetNatGatewayAssociation(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SubnetNatGatewayAssociationState, opts ...pulumi.ResourceOption) (*SubnetNatGatewayAssociation, error) {
var resource SubnetNatGatewayAssociation
err := ctx.ReadResource("azure:network/subnetNatGatewayAssociation:SubnetNa... | [
0.27073732018470764,
-0.1015765443444252,
0.19955256581306458,
-0.32873988151550293,
-0.5575176477432251,
-0.03168128803372383,
-0.6440635919570923,
-0.532559335231781,
0.42356911301612854,
0.11588998883962631,
-0.03709973394870758,
1.060075283050537,
0.2314094603061676,
-0.543060302734375... |
func (o SubnetNatGatewayAssociationOutput) NatGatewayId() pulumi.StringOutput {
return o.ApplyT(func(v *SubnetNatGatewayAssociation) pulumi.StringOutput { return v.NatGatewayId }).(pulumi.StringOutput)
} | [
1.2955286502838135,
0.11116167902946472,
0.09690170735120773,
0.015935957431793213,
-0.24592219293117523,
1.01514732837677,
-0.27047625184059143,
0.13581296801567078,
0.10764589160680771,
0.6064214110374451,
-0.17884942889213562,
1.2832326889038086,
0.47420215606689453,
0.19744330644607544... |
func (o SubnetNatGatewayAssociationOutput) SubnetId() pulumi.StringOutput {
return o.ApplyT(func(v *SubnetNatGatewayAssociation) pulumi.StringOutput { return v.SubnetId }).(pulumi.StringOutput)
} | [
1.7054587602615356,
-0.08290812373161316,
0.24992528557777405,
0.4155212640762329,
0.05881679803133011,
1.267138123512268,
0.04108244553208351,
-0.25970184803009033,
1.1118582487106323,
-0.5055636763572693,
0.2326042801141739,
1.1298152208328247,
0.9583970308303833,
-0.5605121850967407,
... |
func BenchmarkFuncInSide(b *testing.B) {
n := new(name)
for i := 0; i < b.N; i++ {
n.foo2(i)
n.temp2()
}
} | [
0.4835939109325409,
0.7813661098480225,
0.4554961323738098,
-0.05986180528998375,
0.4801473021507263,
-0.422419935464859,
0.36708390712738037,
0.010790564119815826,
-1.546803593635559,
-0.48244842886924744,
-0.9134479761123657,
0.2679440677165985,
-0.48454394936561584,
1.2310906648635864,
... |
func BenchmarkFuncOut(b *testing.B) {
for i := 0; i < b.N; i++ {
foo1(i)
temp()
}
} | [
0.4463672637939453,
1.2052510976791382,
0.2213221937417984,
0.25125086307525635,
1.2609784603118896,
-0.7599270343780518,
1.6998716592788696,
0.4145224392414093,
-1.1165966987609863,
0.05110262706875801,
0.024524610489606857,
0.02643251232802868,
-0.47060906887054443,
0.9815728664398193,
... |
func (task *Task) Execute(t time.Time) (exec.Result, error) {
//Validate the task
if err := task.Validate(); err != nil {
return exec.Result{}, err
}
//Test if the given task should execute in the root croniclePath and the croncilePath is a git repo
taskPathIsCroniclePathWithGit := (task.Path == task.CronicleP... | [
0.44228848814964294,
0.2173459678888321,
0.9736241102218628,
0.5566807985305786,
0.38745808601379395,
0.007087938021868467,
-0.3591715097427368,
-0.0014560153940692544,
-0.5743910074234009,
0.6976174116134644,
-0.1930464655160904,
0.24979105591773987,
0.3502558767795563,
0.2625415623188019... |
func (task *Task) Log(res exec.Result) {
var commit string
var email string
if task.Git.Commit != nil {
commit = task.Git.Commit.Hash.String()[:11]
email = task.Git.Commit.Author.Email
} else {
commit = "null"
email = "null"
}
if res.Error != nil {
log.WithFields(log.Fields{
"schedule": task.Schedu... | [
0.25553247332572937,
0.04396446421742439,
0.7016725540161133,
-0.0073898304253816605,
-0.09759819507598877,
0.16085152328014374,
0.24581745266914368,
0.47878211736679077,
-0.45538392663002014,
0.0964871421456337,
-0.4835241436958313,
-0.4884953200817108,
1.002898931503296,
-0.0597055032849... |
func New(done <-chan bool) (*Stats, error) {
s := &Stats{
registry: cache.New(*cmd.DefaultOptions().Registry),
client: *cmd.DefaultOptions().Client,
}
if err := s.scan(); err != nil {
return nil, err
}
s.Start(done)
return s, nil
} | [
0.6790704131126404,
0.6003847718238831,
0.4505149722099304,
-0.03017241135239601,
0.1251806616783142,
0.2595321834087372,
0.4594053030014038,
-1.0789662599563599,
-0.09628584235906601,
-0.7298489809036255,
0.36005908250808716,
0.5389070510864258,
0.03600361943244934,
0.7158344984054565,
... |
func (s *Stats) Read(ctx context.Context, req *stats.ReadRequest, rsp *stats.ReadResponse) error {
if req.Service == nil {
s.RLock()
rsp.Stats = s.snapshots
s.RUnlock()
return nil
}
filter := func(a, b string) bool {
if len(b) == 0 {
return true
}
return a == b
}
s.RLock()
for _, s := range s.s... | [
-0.3335113525390625,
0.07786816358566284,
0.43461379408836365,
-0.36991119384765625,
-0.25140511989593506,
0.2643110454082489,
-0.023941606283187866,
-0.8441283106803894,
0.7649821043014526,
-0.616789698600769,
0.7996523380279541,
0.22609134018421173,
0.03816172108054161,
0.513689637184143... |
func (s *Stats) Stream(ctx context.Context, req *stats.StreamRequest, rsp stats.Stats_StreamStream) error {
return errors.BadRequest("go.micro.debug.stats", "not implemented")
} | [
-0.4656917452812195,
0.7742379903793335,
0.4499585032463074,
0.5299440622329712,
-0.12577100098133087,
0.8867353200912476,
0.6445749402046204,
-1.1350758075714111,
0.588697075843811,
-1.1036189794540405,
0.6294229030609131,
1.2534327507019043,
0.5153964757919312,
1.5320030450820923,
-0.6... |
func (s *Stats) Start(done <-chan bool) {
go func() {
for {
select {
case <-done:
return
default:
s.scrape()
time.Sleep(time.Second)
}
}
}()
go func() {
t := time.NewTicker(10 * time.Second)
defer t.Stop()
for {
select {
case <-done:
return
case <-t.C:
if err := s... | [
-0.05262204632163048,
0.7303648591041565,
0.6788431406021118,
0.004506299272179604,
0.6115990281105042,
0.2035045623779297,
0.531305730342865,
-0.8073793649673462,
-0.20475289225578308,
-0.23771631717681885,
0.1839209347963333,
0.5169325470924377,
0.37535205483436584,
0.44542041420936584,
... |
func (s *ServerConnection) ActiveHostsGet(query SearchQuery, refresh bool) (ActiveHostList, int, error) {
query = addMissedParametersToSearchQuery(query)
params := struct {
Query SearchQuery `json:"query"`
Refresh bool `json:"refresh"`
}{query, refresh}
data, err := s.CallRaw("ActiveHosts.get", params)... | [
-1.2626030445098877,
-0.3663848042488098,
0.7874244451522827,
-0.2593788504600525,
-0.2990012764930725,
-0.3485293686389923,
0.03564324602484703,
-0.5571842193603516,
-0.2826692759990692,
0.03360610827803612,
-0.756570041179657,
0.23225903511047363,
-0.6138321161270142,
0.07987423241138458... |
func (s *ServerConnection) ActiveHostsGetActivityList(id KId) (ActivityList, error) {
params := struct {
Id KId `json:"id"`
}{id}
data, err := s.CallRaw("ActiveHosts.getActivityList", params)
if err != nil {
return nil, err
}
list := struct {
Result struct {
List ActivityList `json:"list"`
} `json:"res... | [
-0.8854741454124451,
-0.5797428488731384,
0.7598797678947449,
0.27598854899406433,
-0.1646280139684677,
-0.6175154447555542,
0.7618014812469482,
-0.12730726599693298,
0.4587757885456085,
0.8425416350364685,
-0.8685027956962585,
0.8387309312820435,
-1.1675844192504883,
-0.42439740896224976,... |
func (s *ServerConnection) ActiveHostsGetHistogram(histogramType HistogramType, id KId) (*Histogram, error) {
params := struct {
HistogramType HistogramType `json:"histogramType"`
Id KId `json:"id"`
}{histogramType, id}
data, err := s.CallRaw("ActiveHosts.getHistogram", params)
if err != ni... | [
-0.2701738178730011,
0.33447492122650146,
0.8795526027679443,
-0.07554982602596283,
0.02052934840321541,
-0.4776111841201782,
0.3347384035587311,
-0.2774576246738434,
-0.3489830791950226,
0.11348829418420792,
-0.6189594268798828,
0.8967100977897644,
-1.11077880859375,
-0.19155669212341309,... |
func (s *ServerConnection) ActiveHostsGetHistogramInc(histogramIntervalType HistogramIntervalType, id KId, startSampleTime DateTimeStamp) (*Histogram, *DateTimeStamp, error) {
params := struct {
HistogramIntervalType HistogramIntervalType `json:"histogramIntervalType"`
Id KId `... | [
0.13608939945697784,
0.08105333149433136,
0.9556828737258911,
-0.010890633799135685,
-0.6339252591133118,
-0.31741824746131897,
0.4330517053604126,
-0.12918289005756378,
-0.6404169797897339,
0.15200625360012054,
-0.5108862519264221,
0.8618751168251038,
-0.43712368607521057,
0.2105385661125... |
func (s *ServerConnection) ActiveHostsLogout(ids KIdList) error {
params := struct {
Ids KIdList `json:"ids"`
}{ids}
_, err := s.CallRaw("ActiveHosts.logout", params)
return err
} | [
-1.1739628314971924,
-0.5159776210784912,
0.2613132894039154,
-0.05291512608528137,
-0.704677164554596,
-0.15074758231639862,
0.35764163732528687,
-0.0958821028470993,
-0.5955999493598938,
0.8231331706047058,
-1.2889671325683594,
0.37042686343193054,
-0.5759883522987366,
0.0332552418112754... |
func (s *ServerConnection) ActiveHostsLogin(hostId KId, userName string) error {
params := struct {
HostId KId `json:"hostId"`
UserName string `json:"userName"`
}{hostId, userName}
_, err := s.CallRaw("ActiveHosts.login", params)
return err
} | [
-0.7272979617118835,
-0.7497974038124084,
0.4044478237628937,
0.19360779225826263,
-1.319994330406189,
0.23647437989711761,
0.4997544288635254,
-0.20002636313438416,
-0.8752495646476746,
0.06267505139112473,
-1.2899562120437622,
0.7239314913749695,
-0.6443490386009216,
-0.38922563195228577... |
func permutations(arr []byte) [][]byte {
var helper func([]byte, int)
res := [][]byte{}
helper = func(arr []byte, n int) {
if n == 1 {
tmp := make([]byte, len(arr))
copy(tmp, arr)
res = append(res, tmp)
} else {
for i := 0; i < n; i++ {
helper(arr, n-1)
if n%2 == 1 {
tmp := arr[i]
... | [
-0.25955164432525635,
0.9055969715118408,
0.9554929733276367,
0.4738865792751312,
-0.48627257347106934,
-0.4421025216579437,
1.0216991901397705,
-0.39846542477607727,
1.068707823753357,
0.243949756026268,
-0.4219941198825836,
-1.28459894657135,
-0.8826180100440979,
1.4246513843536377,
0.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.