Skip to content

Instantly share code, notes, and snippets.

@yureative
yureative / circusd.init
Created April 15, 2015 02:20
init.d script of circus
#!/bin/bash
### BEGIN INIT INFO
# Provides: circusd
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: circus master control daemon
# Description: This is a daemon that controls the circus minions
#!/bin/bash
branch=`git branch | grep '^\*' | cut -d ' ' -f 2`
merge_branch=${GITHUB_DEFAULT_BRANCH:-master}
git checkout $merge_branch && git pull && git branch -d $branch
git branch
@yureative
yureative / ec2_tags.rb
Last active October 8, 2015 11:26
A sensu mutator to add EC2 instance's tags to event data
#!/usr/bin/env ruby
require 'json'
require 'aws-sdk-core'
module Sensu::Extension
class EC2Tags < Mutator
def name
'ec2_tags'
end
@yureative
yureative / NotifyToSlack.js
Last active October 18, 2015 15:28 — forked from vgeshel/function.js
AWS Lambda function for forwarding SNS notifications to Slack
console.log('Loading function');
const https = require('https');
const url = require('url');
// to get the slack hook url, go into slack admin and create a new "Incoming Webhook" integration
const slack_url = 'https://hooks.slack.com/services/...';
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
slack_req_opts.headers = {'Content-Type': 'application/json'};
@yureative
yureative / promise_seq.js
Last active September 14, 2017 09:09
Sequential execution of promises
const a = (n, timeout) =>
() =>
new Promise((resolve, reject) => {
setTimeout(
() => {
console.log(n)
resolve(n)
},
timeout)
})