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
import json | |
# open file | |
f = open("data.json") | |
# read data | |
line = f.readline() | |
#deserialize | |
data = json.loads(line) |
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
import json | |
# open file for storing data | |
f = open("data.json", w) | |
# create object | |
person = {"name": "test", ...} | |
# store in file | |
f.write(json.dumps(person)) |
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
in, err := ioutil.ReadFile("persons") | |
if err != nil { | |
log.Fatalln("Error reading file:", err) | |
} | |
person := &pb.Person{} | |
if err := proto.Unmarshal(in, person); err != nil { | |
log.Fatalln("Failed to parse person list:", err) | |
} |
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
person := &pb.Person{} | |
person.Name = "test" | |
.... other fields ... | |
out, err := proto.Marshal(person) | |
// writing to file | |
if err != nil { | |
log.Fatalln("Failed to encode person:", err) | |
} | |
if err := ioutil.WriteFile("phones", out, 0644); err != nil { | |
log.Fatalln("Failed to write person:", err) |
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
// Code generated by protoc-gen-go. DO NOT EDIT. | |
// source: message.proto | |
package message | |
import ( | |
fmt "fmt" | |
proto "github.com/golang/protobuf/proto" | |
math "math" | |
) |
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
syntax = "proto3"; | |
message Person { | |
string name = 1; | |
string email = 2; | |
string city = 3; | |
string state = 4; | |
string country = 5; | |
int32 age = 6; | |
string phone = 7; |
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
# Edit ~/.bash_profile | |
# GOPATH is used to specify directories outside of $GOROOT that contain the source for Go projects and their binaries. | |
export GOPATH=/Users/username/go | |
export PATH=$GOPATH/bin:$PATH | |
# Reload profile : source ~/.bash_profile |
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
npm install --save-dev @types/node @types/core-js webpack@latest webpack-dev-server@latest webpack-merge angular2-template-loader awesome-typescript-loader angular2-router-loader del-cli html-loader html-webpack-plugin lite-server raw-loader typescript |
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
#!/bin/bash | |
NAME="hello_app" # Name of the application | |
DJANGODIR=/webapps/hello_django/hello # Django project directory | |
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket | |
USER=hello # the user to run as | |
GROUP=webapps # the group to run as | |
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn | |
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use | |
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name |
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
[merge] | |
keepBackup = false | |
tool = custom | |
[mergetool "custom"] | |
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "$PWD/$BASE" "$PWD/$REMOTE" "$PWD/$LOCAL" "$PWD/$MERGED" | |
keepTemporaries = false | |
trustExitCode = false | |
keepBackup = false |
NewerOlder