Skip to content

Instantly share code, notes, and snippets.

View li0nel's full-sized avatar

Lionel Martin li0nel

View GitHub Profile
@li0nel
li0nel / Contract Killer 3.md
Created October 9, 2015 17:31 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: October 8th 2015
  • Original post

@li0nel
li0nel / index.js
Last active September 25, 2016 06:11
Generates image thumbnails using AWS Lambda
var async = require("async");
var AWS = require("aws-sdk");
var im = require("gm").subClass({imageMagick: true});
var s3 = new AWS.S3();
var path = require("path");
var CONFIG = require("./config.json");
fetch('https://api.hubapi.com/companies/v2/companies/' + inputData.companyId+ '/contacts?hapikey=' + inputData.hapiKey )
.then(function(res) {
return res.json();
})
.then(function(body) {
var contacts = [];
body.contacts.forEach(function(contact) {
contact.identities.forEach(function(identity) {
identity.identity.forEach(function(i) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
fetch('https://api.hubapi.com/companies/v2/companies/' + inputData.companyId + '?hapikey=' + inputData.hapiKey)
.then(function(res) {
return res.json();
})
.then(function(body) {
var output = {id: inputData.companyId, company: body};
callback(null, output);
})
.catch(callback);
@li0nel
li0nel / script.sh
Created December 7, 2017 10:24
AWS configure
aws configure
aws route53 test-dns-answer --hosted-zone-id /hostedzone/ZQPYH2JHZAVQV --record-name laravelaws.com --record-type A
@li0nel
li0nel / web.yaml
Created December 9, 2017 10:59
CloudFormation stack for the web tier
ECSCluster:
Type: AWS::ECS::Cluster
Properties:
ClusterName: !Ref EnvironmentName
ECSAutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
VPCZoneIdentifier: !Ref PrivateSubnets
LaunchConfigurationName: !Ref ECSLaunchConfiguration
@li0nel
li0nel / security-group-ecs.yml
Created December 10, 2017 12:14
CloudFormation template for ECS security group
# This security group defines who/where is allowed to access the ECS hosts directly.
# By default we're just allowing access from the load balancer. If you want to SSH
# into the hosts, or expose non-load balanced services you can open their ports here.
ECSSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId: !Ref VPC
GroupDescription: Access to the ECS hosts and the tasks/containers that run on them
SecurityGroupIngress:
# Only allow inbound access to ECS from the ELB
@li0nel
li0nel / load-balancer-security-group.yaml
Created December 10, 2017 12:16
ELB security group
# This security group defines who/where is allowed to access the Application Load Balancer.
# By default, we've opened this up to the public internet (0.0.0.0/0) but can you restrict
# it further if you want.
LoadBalancerSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId: !Ref VPC
GroupDescription: Access to the load balancer that sits in front of ECS
SecurityGroupIngress:
# Allow access from anywhere to our ECS services
@li0nel
li0nel / database-security-group.yaml
Created December 10, 2017 12:19
RDS security group
# This security group defines who/where is allowed to access the RDS instance.
# Only instances associated with our ECS security group can reach to the database endpoint.
DBSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Open database for access
VpcId: !Ref VPC
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '3306'