Skip to content

Instantly share code, notes, and snippets.

View marcelog's full-sized avatar

Marcelo Gornstein marcelog

View GitHub Profile
@marcelog
marcelog / aws_lambda_hipchat_notifications_for_aws_codedeploy.js
Created May 1, 2016 23:34
Use this Lambda in combination with SNS to send HipChat notifications from CodeDeploy during the lifecycle of a Deploy
var http = require('http');
var https = require('https');
var buffer = require('buffer').Buffer;
var util = require('util');
var querystring = require('querystring');
function hipchat(message, color, callback) {
var token = 'your_hipchat_v1_token';
var body = querystring.stringify({
message: message,
@marcelog
marcelog / main.cf
Created May 8, 2016 14:14
Part of: http://marcelog.github.io/articles/configure_postfix_forward_email_regex_subject_transport_relay.html setting up the postfix main.cf file so we can check the email headers and take actions accordingly
header_checks = regexp:/etc/postfix/header_checks
@marcelog
marcelog / header_checks
Created May 8, 2016 14:15
Part of: http://marcelog.github.io/articles/configure_postfix_forward_email_regex_subject_transport_relay.html Setting up the header_checks file in Postfix so we can route emails based on the subject
/^[sS]ubject:.*Confirmation*/ FILTER smtp:smtp.arelay.com
/^[sS]ubject:.*Reminder*/ FILTER smtp:smtp.arelay.com
#!/bin/bash
postmap hash:/etc/postfix/header_checks
postfix reload
@marcelog
marcelog / main.cf
Created May 8, 2016 14:30
Part of: http://marcelog.github.io/articles/configure_postfix_forward_all_email_smtp_gateway.html Using postfix to route all local emails to an external SMTP gateway
transport_maps = hash:/etc/postfix/transport
@marcelog
marcelog / transport
Created May 8, 2016 14:31
Part of http://marcelog.github.io/articles/configure_postfix_forward_all_email_smtp_gateway.html setting up the Postfix transport file to route (forward) all emails to an external SMTP gateway
* smtp:myotherhost.com
@marcelog
marcelog / reload_postfix_transport.sh
Created May 8, 2016 14:32
Part of: http://marcelog.github.io/articles/configure_postfix_forward_all_email_smtp_gateway.html Reloading postfix so it will pick up the changes in the transport file
#!/bin/bash
postmap hash:/etc/postfix/transport
postfix reload
@marcelog
marcelog / build-php-5.2.sh
Created May 8, 2016 14:41
Part of: http://marcelog.github.io/articles/configure_nginx_php_5.3_5.2_fastcgi.html How to build PHP 5.2 so it can be used through FastCGI
./configure --enable-fastcgi --with-pcre --enable-mbstr-enc-trans --enable-mbstring
./configure --enable-cgi
@marcelog
marcelog / nginx.conf
Created May 8, 2016 14:43
Part of: http://marcelog.github.io/articles/configure_nginx_php_5.3_5.2_fastcgi.html NGINX configuration file to support different (multiple) PHP versions in different virtual hosts by using FastCGI
# Useful to debug rewrite rules and other stuff
error_log logs/error.log notice;
http {
# Debug rewrite rules
rewrite_log on;
}
server {
listen 80;