This file contains 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 com.test; | |
import com.google.cloud.storage.Bucket; | |
import com.google.cloud.storage.Storage; | |
import com.google.cloud.storage.StorageOptions; | |
import java.util.Collection; | |
import java.util.Iterator; | |
import java.io.FileInputStream; | |
import com.google.auth.oauth2.GoogleCredentials; |
This file contains 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
# build stage | |
FROM microsoft/dotnet:2.0.0-preview1-sdk-jessie AS build-env | |
ADD . /app | |
WORKDIR /app/ | |
RUN dotnet restore | |
RUN dotnet publish -c Release | |
# final stage | |
FROM microsoft/dotnet:2.0.0-preview1-runtime-jessie | |
COPY --from=build-env /app /app/ | |
WORKDIR /app/ |
This file contains 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
private static void Execute(IApplicationBuilder app) | |
{ | |
app.Run(async context => | |
{ | |
_logger.LogInformation("HTTP handler called.."); | |
await context.Response.WriteAsync("hello from .NET"); | |
}); | |
} |
This file contains 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
sudo su - | |
wget https://download.docker.com/linux/debian/dists/jessie/pool/edge/amd64/docker-ce_17.05.0~ce-0~debian-jessie_amd64.deb | |
dpkg -i docker-ce_17.05.0~ce-0~debian-jessie_amd64.deb | |
(press Y, when prompted) | |
service docker restart | |
exit |
This file contains 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
apt-get update -y && apt-get install -y unzip curl python openssl python-setuptools python-pip python-dev build-essential nghttp2 libnghttp2-dev libssl-dev | |
curl -OL https://curl.haxx.se/download/curl-7.54.0.tar.bz2 && \ | |
tar -xvjf curl-7.54.0.tar.bz2 && \ | |
cd curl-7.54.0 && \ | |
./configure --with-nghttp2 --with-ssl && \ | |
make && \ | |
make install && \ | |
ldconfig |
This file contains 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
git clone https://github.com/salrashid123/grpc_curl | |
cd grpc_curl/src/ | |
virtualenv env --no-site-packages | |
source env/bin/activate | |
pip install grpcio-tools hexdump | |
python -m grpc_tools.protoc -I . --python_out=. --grpc_python_out=. echo.proto |
This file contains 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
def w(filename): | |
req = echo_pb2.EchoRequest(firstname='john', lastname='doe') | |
msg = binascii.b2a_hex(req.SerializeToString()) | |
frame = '00' + hex(len(msg)/2).lstrip("0x").zfill(8) + msg | |
print 'Raw Encode: ' + frame | |
f = open(filename, "wb+") | |
f.write(binascii.a2b_hex(frame)) | |
f.close() |
This file contains 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
$ xxd frame.bin | |
00000000: 0a04 6a6f 686e 1203 646f 65 ..john..doe | |
$ xxd -p frame.bin | |
0a046a6f686e1203646f65 | |
$ echo `xxd -p frame.bin` | xxd -r -p | protoc --decode_raw | |
1: "john" | |
2: "doe" |
This file contains 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
>>> msg = '0a046a6f686e1203646f65' | |
>>> print '00' + hex(len(msg)/2).lstrip("0x").zfill(8) + msg | |
000000000b0a046a6f686e1203646f65 | |
echo -n '000000000b0a046a6f686e1203646f65' | xxd -r -p - frame.bin |
OlderNewer