Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ecs"
)
package main
import (
"fmt"
"encoding/json"
"time"
"log"
"os"
"path/filepath"
"flag"
@stephencoe
stephencoe / cloud-config.yml
Last active February 18, 2017 10:44
Install docker-compose on CoreOS
#cloud-config
# Uses the docker-compose alpine image
# https://docs.docker.com/compose/install/#/install-as-a-container
coreos:
units:
- name: install-docker-compose.service
command: start
content: |
[Unit]
Description=Install docker-compose
@stephencoe
stephencoe / yml-lint.sh
Created February 18, 2017 09:54
YML Lint
#!/bin/bash
# Validate YML with pretty print output
yml-lint() {
ruby -e "require 'yaml';require'JSON';puts JSON.pretty_generate(JSON.parse(YAML.load_file(\"$@\").to_json))";
}
@stephencoe
stephencoe / index.js
Created December 7, 2016 21:55 — forked from gabmontes/delete-all-my-gists.js
Delete all your gists
var async = require('async');
var GitHubApi = require('github');
var github = new GitHubApi({
version: '3.0.0',
protocol: 'https'
});
github.authenticate({
type: 'basic',
var decryptedRow="";
var pm = PasswordManager.getInstance();
var model = pm.savedPasswordsList_.dataModel;
var pl = pm.savedPasswordsList_;
for(i=0;i<model.length;i++){
PasswordManager.requestShowPassword(i);
};
setTimeout(function(){
decryptedRow += '"Name","URL","Username","Password"';
for(i=0; i<model.length; i++){
@stephencoe
stephencoe / pre-commit
Last active December 28, 2018 11:29
pre push git hooks to check code by changed type
#!/bin/sh
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
# Determine if a file list is passed
if [ "$#" -eq 1 ]
then
oIFS=$IFS
IFS='
@stephencoe
stephencoe / s3-bucket
Created March 11, 2016 18:21
Single bucket access for AWS
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets"
],
"Resource": "arn:aws:s3:::*"
},
@stephencoe
stephencoe / clean_containers.sh
Created August 17, 2015 17:09
Remove all docker containers and images
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@stephencoe
stephencoe / ExampleModel.js
Last active December 28, 2018 11:20
Serve cached images from s3 instead of cloudinary. It needs tidying but it works and reduces bandwidth dramatically. - inspired by https://gist.github.com/dboskovic/23858511bf3c1cbebdbd
//...
Model.add({
content: {
type: Types.Html, wysiwyg: true, height: 400
},
hash : {
type : String,
hidden : true
},