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
| import flask | |
| app = flask.Flask(__name__) | |
| @app.route("/", methods=['GET', 'POST']) | |
| def hello(): | |
| print("Headers") | |
| for header in flask.request.headers: | |
| print(str.format("{0}:{1}", header[0], header[1])) | |
| print(str.format("Querystring: {0}", flask.request.query_string)) |
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
| import com.mongodb.MongoClient; | |
| import com.mongodb.client.MongoCollection; | |
| import org.bson.Document; | |
| import org.mongodb.morphia.AdvancedDatastore; | |
| import org.mongodb.morphia.Morphia; | |
| import org.mongodb.morphia.logging.MorphiaLoggerFactory; | |
| import org.mongodb.morphia.logging.slf4j.SLF4JLoggerImplFactory; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; |
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
| echo "AWS_ACCESS_KEY " $AWS_ACCESS_KEY | |
| echo "AWS_ACCESS_KEY_ID " $AWS_ACCESS_KEY_ID | |
| echo "AWS_SECRET_KEY " $AWS_SECRET_KEY | |
| echo "AWS_SECRET_ACCESS_KEY " $AWS_SECRET_ACCESS_KEY | |
| echo "AWS_SESSION_TOKEN " $AWS_SESSION_TOKEN | |
| echo "AWS_SECURITY_TOKEN " $AWS_SECURITY_TOKEN |
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
| sudo yum install -y python-pip | |
| sudo pip install ansible | |
| sudo pip install boto | |
| sudo pip install awscli |
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
| # Download and install corkscrew to connect to AWS through the proxy. | |
| sudo yum install -y gcc git | |
| git clone https://github.com/elia/corkscrew | |
| cd corkscrew | |
| sudo ./configure make | |
| sudo make install | |
| cd .. | |
| # Access remote servers with the following command line | |
| # ssh ec2-user@54.171.212.46:443 -i ~/ssh_key.pem -o "ProxyCommand corkscrew 10.0.2.2 3128 %h %p" |
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 "fmt" | |
| // fibonacci is a function that returns | |
| // a function that returns an int. | |
| func fibonacci() func() int { | |
| fn_minus_1 := 1 | |
| fn_minus_2 := 0 | |
| index := 0 |
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 "golang.org/x/tour/reader" | |
| type MyReader struct{} | |
| func (MyReader) Read(b []byte) (n int, err error) { | |
| for i := 0; i < len(b); i ++ { | |
| b[i] = 'A' | |
| } |
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 ( | |
| "golang.org/x/tour/pic" | |
| "image" | |
| "image/color" | |
| ) | |
| type Image struct{} |
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 ( | |
| "image" | |
| "image/color" | |
| "image/png" | |
| "math/cmplx" | |
| "os" | |
| ) |
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
| curl -sSL http://downloads.hypriot.com/docker-hypriot_1.8.1-1_armhf.deb >/tmp/docker-hypriot_1.8.1-1_armhf.deb | |
| sudo dpkg -i /tmp/docker-hypriot_1.8.1-1_armhf.deb | |
| rm -f /tmp/docker-hypriot_1.8.1-1_armhf.deb | |
| sudo sh -c 'usermod -aG docker $SUDO_USER' | |
| sudo systemctl enable docker.service | |
| docker pull dhermanns/rpi-mongo |