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
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");
@li0nel
li0nel / Dockerfile
Last active January 30, 2024 19:09
Run crons in Docker ; get cron logs as std Docker log
FROM ubuntu:14.04
MAINTAINER li0nel
USER root
# Install CRON
RUN apt-get update && apt-get -y install sudo && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 && \
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list && \
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);
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,}))$/;
@li0nel
li0nel / gist:7a8fc21e80a3d2b14065ed7aa53f4d13
Last active December 10, 2017 17:19
Create an EC2 key pair to be installed on your EC2 instances
# Create the key pair and extract the private key from the JSON response
aws ec2 create-key-pair
--key-name=laravelaws
--query 'KeyMaterial'
--output text > laravelaws.pem
# Assign appropriate permissions to the key file for it to be usable
chmod 400 laravelaws.pem
# a certificate in your default region for your web application
aws acm request-certificate
--domain-name laravelaws.com
--idempotency-token=random_string_here
--subject-alternative-names *.laravelaws.com
# a certificate from us-east-1 specifically for our CloudFront custom domain
aws --region us-east-1 acm request-certificate
--domain-name laravelaws.com
--idempotency-token=random_string_here
@li0nel
li0nel / script.sh
Last active December 10, 2017 17:47
Login to ECR
# The get-login command outputs the "docker login" command you need to execute with a temporary token
# You can run both directly using eval
# The --no-include-email tells get-login not to return the -e option that does not work for all of Docker versions
eval $(aws ecr get-login --no-include-email)
@li0nel
li0nel / script.sh
Created December 7, 2017 10:24
AWS configure
aws configure
@li0nel
li0nel / dockerbuild.sh
Last active January 1, 2019 05:56
Build and push your Laravel images
# Building our Nginx Docker image and tagging it with the ECR URL
docker build -f Dockerfile-nginx -t YOUR_ECR_REGISTRY_URL_HERE:nginx .
docker push YOUR_ECR_REGISTRY_URL_HERE:nginx
# Building our Laravel Docker image and tagging it with the ECR URL
docker build -t YOUR_ECR_REGISTRY_URL_HERE:laravel .
docker push YOUR_ECR_REGISTRY_URL_HERE:laravel