Skip to content

Instantly share code, notes, and snippets.

@elbuo8
elbuo8 / main.tf
Created February 8, 2017 22:17
Compose Blog Sample
provider "aws" {
region = "us-east-1" # feel free to adjust
}
module "vpc" {
source = "github.com/segmentio/stack//vpc"
name = "my-test-vpc"
environment = "staging"
cidr = "10.30.0.0/16"
internal_subnets = ["10.30.0.0/24"]

Keybase proof

I hereby claim:

  • I am elbuo8 on github.
  • I am elbuo8 (https://keybase.io/elbuo8) on keybase.
  • I have a public key ASDzjvkerEfqiRzSCaW1lg809V9sK439TwCnyksXeWgvZAo

To claim this, I am signing this object:

@elbuo8
elbuo8 / deploy.sh
Created October 27, 2016 03:37
zeit deployment
$ cd your/app
$ now deploy -t $ZEIT_TOKEN --docker
$ DEPLOYMENT_INFO=$(curl -H "Authorization: Bearer $ZEIT_TOKEN" https://api.zeit.co/now/deployments | json -c "console.log(JSON.stringify(this.deployments.filter((e) => {return e.name === 'NAME OF YOUR APP'}).reduce((a, b) => {return a.created > b.created ? a : b})))")
$ echo "running simple check"
$ curl -i -L $(echo $DEPLOYMENT_INFO | json url)
$ now alias $(echo $DEPLOYMENT_INFO | json uid) YOURDOMAIN.com -t $ZEIT_TOKEN
module.exports = {
production: {
store: {
type: 'S3',
bucket: 'YOUR BUCKET'
},
assets: {
accessKeyId: AWS_ACCESS_KEY_ID,
secretAccessKey: AWS_SECRET_KEY
}
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<HostName>app.domain.com</HostName>
<ReplaceKeyPrefixWith>#!/</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
#
# This is the default config file. It allows all users to do anything,
# so don't use it on production systems.
#
# Look here for more config file examples:
# https://github.com/rlidwka/sinopia/tree/master/conf
#
listen: 0.0.0.0:4873
@elbuo8
elbuo8 / sg.js
Created January 11, 2015 17:37
Parse sending
var sendgrid = require('sendgrid');
sendgrid.initialize('SENDGRID-USERNAME', 'SENDGRID-PASSOWORD');
var email = sendgrid.Email();
email.addTo('john@email.com');
email.setFrom('doe@email.com');
email.setSubject('Hello!');
email.setText('YAY');
email.addFilter("templates", "enabled", "1");
email.addFilter("templates", "template_id","the_code_of_the_needed_template");
(function (angular) {
'use strict';
var sendgrid = angular.module('sendgrid', ['cordovaHTTP']);
sendrid.provider('sendgrid', ['cordovaHTTP', function SendGridProvider('cordovaHTTP') {
/*
SMTPAPI Library
*/
function calculateDistance(lat1, lon1, lat2, lon2) {
var R = 6371; // km
var dLat = (lat2 - lat1).toRad();
var dLon = (lon2 - lon1).toRad();
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
var d = R * c;
return d;
package main
import (
"fmt"
"io/ioutil"
"net/http"
"github.com/codegangsta/negroni"
jwt "github.com/dgrijalva/jwt-go"
"github.com/gorilla/mux"