Skip to content

Instantly share code, notes, and snippets.

@lhitchon
lhitchon / rules.yml
Created October 18, 2018 21:27
Example of using config-lint for validating a CloudFormation ChangeSet
#
# Rules that can scan a CloudFormation ChangeSet and report a failure if a DynamoDB Table will be replaced
#
# Find config-lint here: https://github.com/stelligent/config-lint
#
# Example usage:
#
# aws cloudformation describe-change-set --stack-name <STACK_NAME> --change-set-name <CHANGESET_NAME> |
# config-lint -rules rules.yml -
#
from cfnlint import CloudFormationLintRule
from cfnlint import RuleMatch
import yaml
import jmespath
class MyCheck(CloudFormationLintRule):
"""MyCheck"""
id = 'E737'
shortdesc = 'Check Something'
source 'https://rubygems.org'
gem 'rails', '3.2.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
@lhitchon
lhitchon / Gemfile
Created January 23, 2013 23:57
Standalone ruby 1.9 app that uses redis
source 'https://rubygems.org'
gem 'rake'
gem 'redis'
gem 'cf-runtime'
@lhitchon
lhitchon / Gemfile
Created December 14, 2012 04:18
Modular Sinatra app deployed to AppFog
source 'http://rubygems.org'
gem 'sinatra'
gem 'thin'
gem 'rack'
var connect = require('connect'),
mongodb = require('mongodb');
var showDBInfo = function(req,res) {
res.end("You are connected to the database");
};
var noDatabaseError = function(res) {
res.statusCode = 500;
res.end("Unable to connect to database");
@lhitchon
lhitchon / gist:3098643
Created July 12, 2012 14:57
docs server that automatically redirects to url with .html if that file exists
var connect = require('connect'),
fs = require('fs');
var serve_html = function(root) {
return function(req,res,next) {
var path = root + req.url + '.html';
fs.stat(path,function(err,stat) {
if (!err && !stat.isDirectory()) {
res.statusCode = 301;
res.setHeader('Location', req.url + '.html');
@lhitchon
lhitchon / index.php
Created April 12, 2012 18:10
PHP MySQL Test
<h1>Test MySQL Connection</h1>
<?php
$services = getenv("VCAP_SERVICES");
$services_json = json_decode($services,true);
$mysql_config = $services_json["mysql-5.1"][0]["credentials"];
// ** MySQL settings from resource descriptor ** //
$username = $mysql_config["username"];
@lhitchon
lhitchon / index.php
Created February 10, 2012 21:18
Gist PHP App
<?php echo "Hello" ?>
@lhitchon
lhitchon / Gemfile
Created February 10, 2012 21:11
Gist Sinatra App
source 'http://rubygems.org'
gem 'sinatra'