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
#!/usr/bin/env bash | |
find "$1" -depth -print0 | while IFS= read -r -d '' file; do | |
d="$( dirname "$file" )" | |
f="$( basename "$file" )" | |
new="${f//[^a-zA-Z0-9\/\._\-]/}" | |
if [ "$f" != "$new" ] # if equal, name is already clean, so leave alone | |
then | |
if [ -e "$d/$new" ] | |
then | |
echo "Notice: \"$new\" and \"$f\" both exist in "$d":" |
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
# First Stage | |
FROM golang:1.6-alpine | |
RUN mkdir /app | |
ADD . /app/ | |
WORKDIR /app | |
RUN go build -o main . | |
# Second Stage | |
FROM alpine | |
EXPOSE 8000 |
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
const datastore = require('google-cloud').datastore; | |
const _PROJECT_ID = 'my-project'; | |
var datastoreClient = datastore({ | |
projectId: _PROJECT_ID | |
}); | |
exports.subscribe = function subscribe(event, callback) { | |
const pubsubMessage = event.data; |
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
steps: | |
- name: 'gcr.io/cloud-builders/npm' | |
args: ['install'] | |
- name: 'gcr.io/cloud-builders/npm' | |
args: ['test'] | |
- name: 'gcr.io/cloud-builders/docker' | |
args: ["build", "-t", "gcr.io/$PROJECT_ID/frontend:$REVISION_ID", "."] | |
- name: 'gcr.io/cloud-builders/docker' | |
args: ["push", "gcr.io/$PROJECT_ID/frontend:$REVISION_ID"] | |
- name: 'gcr.io/cloud-builders/gcloud' |
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
const async = require('async'); | |
const google = require('googleapis'); | |
const k8s = require('kubernetes-client'); | |
const container = google.container('v1'); | |
const PROJECT_ID = 'node-example-gke'; | |
const ZONE = 'us-east1-b'; | |
const CLUSTER_ID = 'node-example-cluster'; | |
const NAMESPACE = 'default'; |
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
global | |
log 127.0.0.1 local0 | |
maxconn 8192 | |
user haproxy | |
group haproxy | |
defaults | |
log global | |
mode http | |
option httplog |
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
var async = require('async') | |
, _ = require('underscore'); | |
var array = [1,2,3,4,5]; | |
async.map(array, function(item, cb) { | |
if (item === 3) | |
return cb(); | |
else | |
return cb(null, item*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
global | |
log 127.0.0.1:514 local0 | |
defaults | |
mode http | |
log global | |
option httplog | |
option http-server-close | |
option dontlognull | |
option redispatch |
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
var request = require('request'); | |
function postMessage(access_token, page_id, message, response) { | |
// Specify the URL and query string parameters needed for the request | |
var url = 'https://graph.facebook.com/' + page_id + '/feed'; | |
var params = { | |
access_token: access_token, | |
message: message | |
}; |
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
for (var i=0; i<10; i++) { | |
setTimeout(function() { // to simulate a random I/O call | |
console.log('i = ', i); | |
}, 100); | |
} | |
/* | |
i = 10 | |
i = 10 | |
i = 10 |