View interface.go
package main
import "fmt"
type Stringer interface {
String() string
}
type Person struct {
Name string
View http.go
package http
import (
"net/http"
"github.com/benbjohnson/myapp"
)
type Handler struct {
SomeService myapp.SomeService
View template.go
// indexTemplate is the main site template.
// The default template includes two template blocks ("sidebar" and "content")
// that may be replaced in templates derived from this one.
var indexTemplate = template.Must(template.ParseFiles("index.tmpl"))
// Index is a data structure used to populate an indexTemplate.
type Index struct {
Title string
Body string
Links []Link
View notes.go
x := 1
p := &x // p, of type *int, point to x
fmt.Println(*p) // "1"
*p = 2 // equivalent to x = 2
fmt.Println(x) // "2"
const IPv4Len = 4
func parseIPv$(s string) IP {
vap p [IPv4Len]byte
View Makefile
# Updated 10/17 Alec Cunningham
# Required resources for kubernetes
# kubectl create secret generic cloudsql-oauth-credentials --from-file=creds/db-access.json
# kubectl create secret generic --from-literal=username=root --from-literal=password=root
# kubectl create configmap settings --from-file=config/configmap.yaml
# Used for PROJECT_ID
GCLOUD_PROJECT = container-builder-186003
# GRC URL
REPO := gcr.io/$(GCLOUD_PROJECT)/
View vimium key shortcuts
Keyboard Bindings
Modifier keys are specified as <c-x>, <m-x>, and <a-x> for ctrl+x, meta+x, and alt+x respectively. See the next section for how to customize these bindings.
Once you have Vimium installed, you can see this list of key bindings at any time by typing ?.
Navigating the current page:
? show the help dialog for a list of all available keys
h scroll left
View gist:ecc290e2d4786507bdd84e96d3c8efab
https://docs.projectcalico.org/v2.6/getting-started/kubernetes/
https://cloud.google.com/kubernetes-engine/docs/network-policy
blog.kubernetes.io/2017/10/enforcing-network-policies-in-kubernetes.html
View pubsub.py
#!/usr/bin/python
# pip install --upgrade google-cloud-pubsub
# gcloud beta pubsub topics create my-topic
# gcloud beta pubsub subscriptions create my-sub --topic my-topic
#gcloud beta pubsub subscriptions delete mySubscription
# gcloud beta pubsub topics delete myTopic
def publish_messages(project, topic_name):
View autodeploy-kubernetes-gitlabci.yml
# This file is a template, and might need editing before it works on your project.
# Explanation on the scripts:
# https://gitlab.com/gitlab-examples/kubernetes-deploy/blob/master/README.md
image: registry.gitlab.com/gitlab-examples/kubernetes-deploy
variables:
# Application deployment domain
KUBE_DOMAIN: domain.example.com
stages:
View vpn-setup.sh
# Google Cloud Platform VPN
# Create the first network and subnetwork
gcloud compute networks create \
vpn-network-1
# Subnet
gcloud compute networks subnets create \
subnet-a \
--network vpn-network-1 \