This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM gliderlabs/alpine | |
| RUN apk add --update git build-base linux-headers wget tar perl zlib zlib-dev bzip2 bzip2-dev && \ | |
| cd /tmp && \ | |
| wget https://gflags.googlecode.com/files/gflags-2.0-no-svn-files.tar.gz && \ | |
| tar -xzvf gflags-2.0-no-svn-files.tar.gz && \ | |
| cd gflags-2.0 && \ | |
| ./configure && make && make install && \ | |
| cd /tmp && \ | |
| wget https://snappy.googlecode.com/files/snappy-1.1.1.tar.gz && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "flag" | |
| "log" | |
| "net/http" | |
| "strings" | |
| ) | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <curl/curl.h> | |
| int main(void) | |
| { | |
| CURL *curl; | |
| CURLcode res; | |
| /* In windows, this will init the winsock stuff */ | |
| curl_global_init(CURL_GLOBAL_ALL); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Building Blockchain in Go | |
| https://jeiwan.cc/posts/building-blockchain-in-go-part-1/ | |
| https://github.com/Jeiwan/blockchain_go | |
| ## Code your own blockchain in less than 200 lines of Go! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -e | |
| protobuf_directories=$(find . -not -path ./.git/ -not -path ./.idea/ -type d -name "pb") | |
| googleapis_path=$(go list -m -f '{{.Dir}}' github.com/googleapis/googleapis) | |
| while read -r p; do | |
| echo "generating protobuf for $p" | |
| protoc -I. -I$googleapis_path --go_out=plugins=grpc:. $p/*.proto | |
| done <<< "$protobuf_directories" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is a test where I was trying to isolate how much we lost to `reflect` | |
| // with channel operations in a tight loop. | |
| // | |
| // PREAMBLE | |
| // We do a lot of processing of stream data where ordering with respect to a | |
| // shard indicator like user ID matters. We've done this a few times where we | |
| // implement fanout based on hashing into an slice/array of channels, and it's | |
| // lightning fast but it ends up leaving a lot of boilerplate in your code. | |
| // | |
| // So I started writing a library that would do the non-critical boilerplate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### IMPROVE SYSTEM MEMORY MANAGEMENT ### | |
| # Increase size of file handles and inode cache | |
| fs.file-max = 2097152 | |
| # Do less swapping | |
| vm.swappiness = 10 | |
| vm.dirty_ratio = 60 | |
| vm.dirty_background_ratio = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package components | |
| import "syscall" | |
| func setpriority() { | |
| syscall.Setpriority(syscall.PRIO_PGRP, 0, 9) | |
| } |