id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c9700
cnt := int(64-br.numBits) / 8 if cnt > len(br.bufPeek) { cnt = len(br.bufPeek) } for _, c := range br.bufPeek[:cnt] { br.bufBits |= uint64(c) << br.numBits br.numBits += 8 } br.bufPeek = br.bufPeek[cnt:] if br.numBits > 56 { break } } br.fedBits = br.numBits } else { for ...
c9701
val := uint(br.bufBits & uint64(1<<nb-1)) br.bufBits >>= nb br.numBits -= nb return val }
c9702
:= chunk >> prefixCountBits chunk = pd.links[linkIdx][uint32(br.bufBits>>pd.chunkBits)&pd.linkMask] nb = uint(chunk & prefixCountMask) } if nb <= br.numBits { br.bufBits >>= nb br.numBits -= nb return uint(chunk >> prefixCountBits) } } }
c9703
uint { rc := rcs[sym] return uint(rc.base) + br.ReadBits(uint(rc.bits)) }
c9704
maxSyms) } else { br.readComplexPrefixCode(pd, maxSyms, hskip) } }
c9705
} } switch nsym { case 1: copyLens(simpleLens1[:]) case 2: copyLens(simpleLens2[:]) compareSwap(0, 1) case 3: copyLens(simpleLens3[:]) compareSwap(0, 1) compareSwap(0, 2) compareSwap(1, 2) case 4: if tsel := br.ReadBits(1) == 1; !tsel { copyLens(simpleLens4a[:]) } else { copyLens(simpl...
c9706
if repSym != repSymLast { repCntLast = 0 repSymLast = repSym } nb := repSym - 14 // 2..3 bits rep := br.ReadBits(nb) + 3 // 3..6 or 3..10 if repCntLast > 0 { rep += (repCntLast - 2) << nb // Modify previous repeat count } repDiff := rep - repCntLast // Always positive repCnt...
c9707
setU32(d, c.Offset, c.Value) } return d }
c9708
cs { if getU32(d, c.Offset) != c.Value { return false } } return true }
c9709
+= uint(c.Len * c.Cnt) } return nb }
c9710
sum -= (1 << valueBits) >> uint(c.Len) } return sum == 0 || len(pc) == 0 }
c9711
c2.Len && c1.Val&mask == c2.Val&mask { return false } } } return true }
c9712
+ 1]uint var code uint for i := minBits; i <= maxBits; i++ { code <<= 1 nextCodes[i] = code code += bitCnts[i] } if code != 1<<maxBits { return errorf(errors.Invalid, "degenerate prefix tree") } // Assign the code to each symbol. for i, c := range codes { codes[i].Val = internal.ReverseUint32N(uint32...
c9713
used } size := int(1<<wbits) - 16 br.dict.Init(size) br.readBlockHeader() }
c9714
// Use blkLen to track metadata number of bytes br.readMetaData() return } blkLen = int(br.rd.ReadBits(nibbles * 4)) if nibbles > 4 && blkLen>>((nibbles-1)*4) == 0 { errors.Panic(errCorrupted) // Shortest representation not used } br.blkLen = blkLen + 1 // Read ISUNCOMPRESSED and process uncompressed data...
c9715
never panic with io.EOF } else if cnt < int64(br.blkLen) { errors.Panic(io.ErrUnexpectedEOF) } br.step = (*Reader).readBlockHeader }
c9716
br.toRead = br.dict.ReadFlush() br.step = (*Reader).readRawData // We need to continue this work return } br.step = (*Reader).readBlockHeader }
c9717
0; i < len(cm); { sym := br.rd.ReadSymbol(&br.rd.prefix) if sym == 0 || sym > maxRLE { // Single non-zero value. if sym > 0 { sym -= maxRLE } cm[i] = uint8(sym) i++ } else { // Repeated zeros. n := int(br.rd.ReadOffset(sym-1, maxRLERanges)) if i+n > len(cm) { errors.Panic(errCorru...
c9718
default: symType -= 2 } bd.types = [2]uint8{uint8(symType), bd.types[0]} symLen := br.rd.ReadSymbol(&bd.decLen) bd.typeLen = int(br.rd.ReadOffset(symLen, blkLenRanges)) }
c9719
tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, } } return cfg }
c9720
host.TLSConfig != nil { return host.TLSConfig, nil } // Build and save the host config host.TLSConfig = a.buildTLSConfig(clientHelloInfo, host) return host.TLSConfig, nil }
c9721
name)) } dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ TagName: "yaml", Result: p, }) err = dec.Decode(r) if err != nil { panic(err) } return }
c9722
setInterval) d.PushGlobalGoFunction("clearTimeout", clearTimeout) d.PushGlobalGoFunction("clearInterval", clearTimeout) return nil } else { d.Pop() return errors.New("Timers are already defined") } }
c9723
d := new(digest32) d.seed = seed d.bmixer = d d.Reset() return d }
c9724
d := (*digest64)(New128WithSeed(seed).(*digest128)) return d }
c9725
seed d.bmixer = d d.Reset() return d }
c9726
return nil, err } h := sha256.New() if _, err := h.Write(append(leftBytes, rightBytes...)); err != nil { return nil, err } return h.Sum(nil), nil }
c9727
err := h.Write(append(n.Left.Hash, n.Right.Hash...)); err != nil { return nil, err } return h.Sum(nil), nil }
c9728
root, merkleRoot: root.Hash, Leafs: leafs, } return t, nil }
c9729
if len(leafs)%2 == 1 { duplicate := &Node{ Hash: leafs[len(leafs)-1].Hash, C: leafs[len(leafs)-1].C, leaf: true, dup: true, } leafs = append(leafs, duplicate) } root, err := buildIntermediate(leafs) if err != nil { return nil, nil, err } return root, leafs, nil }
c9730
nl[right], Hash: h.Sum(nil), } nodes = append(nodes, n) nl[left].Parent = n nl[right].Parent = n if len(nl) == 2 { return n, nil } } return buildIntermediate(nodes) }
c9731
err } m.Root = root m.Leafs = leafs m.merkleRoot = root.Hash return nil }
c9732
if err != nil { return err } m.Root = root m.Leafs = leafs m.merkleRoot = root.Hash return nil }
c9733
if err != nil { return false, err } if bytes.Compare(m.merkleRoot, calculatedMerkleRoot) == 0 { return true, nil } return false, nil }
c9734
if err != nil { return false, err } leftBytes, err := currentParent.Left.calculateNodeHash() if err != nil { return false, err } if _, err := h.Write(append(leftBytes, rightBytes...)); err != nil { return false, err } if bytes.Compare(h.Sum(nil), currentParent.Hash) != 0 { ...
c9735
+= fmt.Sprint(l) s += "\n" } return s }
c9736
dotsql := &DotSql{ queries: queries, } return dotsql, nil }
c9737
return nil, err } defer f.Close() return Load(f) }
c9738
bytes.NewBufferString(sql) return Load(buf) }
c9739
= lrucache.New(maxLen, expiration) }
c9740
cd.setItem(item) cd.afterSet(item) return err }
c9741
cd.Get(key, nil) == nil }
c9742
return cd.get(nil, key, object) }
c9743
err := cd.once(item) cd.afterOnce(item) return err }
c9744
stats.LocalHits = atomic.LoadUint64(&cd.localHits) stats.LocalMisses = atomic.LoadUint64(&cd.localMisses) } return &stats }
c9745
gp := geopattern.Generate(args) fmt.Println(gp) }
c9746
:= pattern.New(args) return p.SvgStr() }
c9747
base64Str := base64.StdEncoding.EncodeToString([]byte(svgStr)) return base64Str }
c9748
fmt.Sprintf("url(data:image/svg+xml;base64,%s);", base64Str) }
c9749
h.Sum(nil) return fmt.Sprintf("%x", hash) }
c9750
bMin return (bMax - (aMax-value)*(bRange/aRange)) }
c9751
hexVal, err := strconv.ParseInt(hexStr, 16, 0) if err != nil { panic(err) } return float64(hexVal) }
c9752
map[string]interface{} { for k, v := range mapA { mapB[k] = v } return mapB }
c9753
gp := geopattern.URIimage(args) fmt.Println(gp) }
c9754
"" { generator = args["generator"] } if args["color"] != "" { color = args["color"] } if args["baseColor"] != "" { baseColor = args["baseColor"] } return &Pattern{BaseColor: baseColor, Color: color, Generator: generator, Hash: utils.Hash(phrase), Svg: new(svg.SVG)} }
c9755
p.genaratePattern() return p.Svg.Str() }
c9756
>= 0 { c += float64(satOffset) } else { c -= float64(satOffset) } rgb = colorful.Color{h, c, l} } r, g, b := int(rgb.R*105), int(rgb.G*105), int(rgb.B*150) args := make(map[string]interface{}) args["fill"] = fmt.Sprintf("rgb(%v, %v, %v)", r, g, b) p.Svg.Rect(0, 0, "100%", "100%", args) }
c9757
{ return true } } return false }
c9758
"hexagons": p.geoHexagons() case "mosaic-squares": p.geoMosaicSquares() case "nested-squares": p.geoNestedSquares() case "octagons": p.geoOctagons() case "overlapping-circles": p.geoOverlappingCircles() case "overlapping-rings": p.geoOverlappingRings() case "plaid": p.geoPlaid() case "plus-signs":...
c9759
1 style := make(map[string]interface{}) style["transform"] = fmt.Sprintf("translate(%v, %v)", float64(x)*chevronWidth, float64(y)*chevronHeight*0.66-chevronHeight/2) p.Svg.Group(chevron, utils.Merge(styles, style)) if y == 0 { style["transform"] = fmt.Sprintf("translate(%v, %v)", float64(x)*chevronW...
c9760
styles["style"] = map[string]string{"opacity": fmt.Sprintf("%v", opacity), "stroke-width": fmt.Sprintf("%vpx", strokeWidth)} p.Svg.Circle(cx, cy, ringSize/2, styles) val = utils.HexVal(p.Hash, 39-i, 1) opacity = utils.Opacity(val) fill = utils.FillColor(val) styles = make(map[string]interface{}) s...
c9761
%v)", dx + 6*diamondWidth - diamondWidth/2, diamondHeight/2*float64(y) - diamondHeight/2) p.Svg.Polyline(diamond, utils.Merge(styles, style)) } if y == 0 { style["transform"] = fmt.Sprintf("translate(%v, %v)", dx + float64(x)*diamondWidth - diamondWidth/2, diamondHeight/2*6 - diamondHeight/2) p.Svg....
c9762
if y%2 == 0 { shapes.DrawInnerMosaicTile(p.Svg, float64(x)*triangleSize*2, float64(y)*triangleSize*2, triangleSize, values) } else { shapes.DrawOuterMosaicTile(p.Svg, float64(x)*triangleSize*2, float64(y)*triangleSize*2, triangleSize, utils.HexVal(p.Hash, i, 1)) } } i = i + 1 } } }
c9763
utils.FillColor(val) styles = make(map[string]interface{}) styles["fill"] = "none" styles["stroke"] = fill styles["style"] = map[string]string{"opacity": fmt.Sprintf("%v", opacity), "stroke-width": fmt.Sprintf("%vpx", blockSize)} p.Svg.Rect(float64(x)*squareSize+float64(x)*blockSize*2+blockSize/2+bloc...
c9764
styles["stroke"] = utils.StrokeColor styles["stroke-opacity"] = utils.StrokeOpacity styles["transform"] = fmt.Sprintf("translate(%v, %v)", float64(x)*squareSize, float64(y)*squareSize) p.Svg.Polyline(tile, styles) i = i + 1 } } }
c9765
if x == 0 { p.Svg.Circle(6*radius, float64(y)*radius, radius, styles) } if y == 0 { p.Svg.Circle(float64(x)*radius, 6*radius, radius, styles) } if x == 0 && y == 0 { p.Svg.Circle(6*radius, 6*radius, radius, styles) } i = i + 1 } } }
c9766
x == 0 { p.Svg.Circle(6*ringSize, float64(y)*ringSize, ringSize-(strokeWidth/2), styles) } if y == 0 { p.Svg.Circle(float64(x)*ringSize, 6*ringSize, ringSize-(strokeWidth/2), styles) } if x == 0 && y == 0 { p.Svg.Circle(6*ringSize, 6*ringSize, ringSize-(strokeWidth/2), styles) } i = i ...
c9767
fill := utils.FillColor(val) stripeWidth := val + 5 styles := make(map[string]interface{}) styles["opacity"] = opacity styles["fill"] = fill p.Svg.Rect(width, 0, stripeWidth, "100%", styles) width = width + int(stripeWidth) j = j + 2 i = i + 1 } p.Svg.SetHeight(int(height)) p.Svg.SetWidth(int...
c9768
S %v 0, %v, %v", amplitude, xOffset, period/2-xOffset, period/2, amplitude, period-xOffset, amplitude*2, period, amplitude, period*1.5-xOffset, period*1.5, amplitude) style := make(map[string]interface{}) style["transform"] = fmt.Sprintf("translate(-%v, %v)", period/4, (waveWidth*float64(i))-(amplitude*1.5)) p...
c9769
styles["stroke"] = utils.StrokeColor styles["stroke-opacity"] = utils.StrokeOpacity p.Svg.Rect(float64(x)*squareSize, float64(y)*squareSize, squareSize, squareSize, styles) i = i + 1 } } }
c9770
180 } } style := make(map[string]interface{}) style["transform"] = fmt.Sprintf("translate(%v, %v) rotate(%v, %v, %v)", float64(x)*sideLength*0.5-sideLength/2, triangleHeight*float64(y), rotation, sideLength/2, triangleHeight/2) p.Svg.Polyline(triangle, utils.Merge(styles, style)) if x == 0 { ...
c9771
return fmt.Sprintf("%v,0,%v,0,%v,%v,%v,%v,%v,%v,%v,%v,0,%v,0,%v,%v,0", c, s-c, s, c, s, s-c, s-c, s, c, s, s-c, c, c) }
c9772
return fmt.Sprintf("%v,0,%v,%v,0,%v,%v,0", halfWidth, sideLength, height, height, halfWidth) }
c9773
width/2, width, height/2, width/2, height, height/2) }
c9774
:= sideLength / 2 return fmt.Sprintf("0,0,%v,%v,0,%v,0,0", width, halfHeight, sideLength) }
c9775
return fmt.Sprintf("0,%v,%v,0,%v,0,%v,%v,%v,%v,%v,%v,0,%v", b, a, a+c, 2*c, b, a+c, 2*b, a, 2*b, b) }
c9776
fmt.Sprintf("<polyline points='%v,%v,%v,0,%v,%v,%v,%v,%v,%v' />", width/2, height-e, width, width, e, width/2, height, width/2, height-e) return elements }
c9777
x='0' y='%v' width='%v' height='%v' />", squareSize, squareSize*3, squareSize) return elements }
c9778
fmt.Sprintf("translate(%v, %v) scale(-1, -1)", x+triangleSize*2, y+triangleSize) s.Polyline(triangle, utils.Merge(styles, style)) style["transform"] = fmt.Sprintf("translate(%v, %v) scale(1, 1)", x, y+triangleSize) s.Polyline(triangle, utils.Merge(styles, style)) style["transform"] = fmt.Sprintf("translate(%v, %...
c9779
s.svgString + s.footer() }
c9780
:= fmt.Sprintf("<rect x='%v' y='%v' width='%v' height='%v' %s />", x, y, w, h, s.WriteArgs(args)) s.svgString += rectStr }
c9781
r='%v' %s />", cx, cy, r, s.WriteArgs(args)) s.svgString += circleStr }
c9782
%s />", str, s.WriteArgs(args)) s.svgString += pathStr }
c9783
/>", str, s.WriteArgs(args)) s.svgString += polylineStr }
c9784
s.svgString += elements[0] + elements[1] s.svgString += "</g>" }
c9785
str += fmt.Sprintf("%s='", k) for K, V := range v.(map[string]string) { str += fmt.Sprintf("%s:%s;", K, V) } str += "' " } } } return str }
c9786
gp := geopattern.Base64String(args) fmt.Println(gp) }
c9787
if err != nil { return nil, err } text, err := ioutil.ReadAll(r) if err != nil { return nil, err } return text, nil }
c9788
ok := adapters[host]; ok { return a } return DefaultAdapter }
c9789
query, Host: host, FetchedAt: time.Now().UTC(), MediaType: "text/plain", Charset: "utf-8", } }
c9790
return "" } return string(text) }
c9791
if err != nil { return nil, err } return transform.NewReader(bytes.NewReader(res.Body), enc.NewDecoder()), nil }
c9792
nil, fmt.Errorf("no encoding found for %s", res.Charset) } return enc, nil }
c9793
return } res.MediaType = mt // Character set (e.g. utf-8) cs, ok := params["charset"] if ok { res.Charset = cs } res.DetectCharset() }
c9794
> 50 } // Prefer charset if HTML, otherwise ICU if !ok2 && (ok1 || html) { res.Charset = cs1 } else { res.Charset = cs2 } // fmt.Printf("Detected charset via go.net/html/charset: %s (%t)\n", cs1, ok1) // fmt.Printf("Detected charset via saintfish/chardet: %s (%d)\n", cs2, r[0].Confidence) }
c9795
strings.ToLower(hex.EncodeToString(h.Sum(nil))) }
c9796
h.Set("Content-Length", strconv.Itoa(len(res.Body))) h.Set("Content-Checksum", res.Checksum()) return h }
c9797
map[string]string{"charset": res.Charset}) }
c9798
if err != nil { return err } _, err = w.Write(res.Body) if err != nil { return err } return nil }
c9799
nil { return res, err } if res.FetchedAt, err = time.Parse(time.RFC3339, h.Get("Fetched-At")); err != nil { return res, err } mt, params, err := mime.ParseMediaType(h.Get("Content-Type")) if err != nil { return res, err } res.MediaType = mt res.Charset = params["charset"] return res, nil }