Skip to content

Instantly share code, notes, and snippets.

View stojg's full-sized avatar

Stig Lindqvist stojg

View GitHub Profile
@stojg
stojg / graylog2
Last active August 29, 2015 14:05
graylog2 init file
#!/bin/bash
### BEGIN INIT INFO
# Provides: graylog2
# Required-Start: elasticsearch
# Required-Stop: elasticsearch
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts GrayLog2
# Description: Starts GrayLog2 using start-stop-daemon
### END INIT INFO
@stojg
stojg / graylog2-web-interface
Last active August 29, 2015 14:05
graylog2-web-interface init
#!/bin/bash
### BEGIN INIT INFO
# Provides: graylog2-web
# Required-Start: $graylog2
# Required-Stop: $graylog2
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts graylog2-web
# Description: Starts graylog2-web using start-stop-daemon
### END INIT INFO
---
- hosts: all
sudo: yes
tasks:
- apt: pkg={{ item }} state=latest
with_items:
- vim
- git
- tar
- apache2
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"Stmt9dsun432j",
"Effect":"Allow",
"Action":[
"elasticloadbalancing:CreateLBCookieStickinessPolicy",
"elasticloadbalancing:SetLoadBalancerPoliciesOfListener",
"elasticloadbalancing:DescribeInstanceHealth",
@stojg
stojg / gist:e550f153f5a006e0afbd
Created October 13, 2014 01:12
full-contact-di.yml
name: OrderController
---
OrderController:
dependencies:
mailerService: %$MailerService
Injector:
MailerService:
factory: MailerFactory
MailerFactory:
class: MailerFactoryImplementation
@stojg
stojg / Refresh Tracks.scpt
Created October 15, 2014 00:55
Refresh Tracks.scpt
(*
Install in /Library/iTunes/Scripts
*)
tell application "iTunes"
if selection is {} then
display dialog "No tracks selected. Select some tracks with some stale tags." buttons {"I will!"} ¬
default button 1 with icon 0
else
@stojg
stojg / _config.php
Last active August 29, 2015 14:07
AWS Dynamodb Session for SilverStirpe
<?php
use Aws\DynamoDb\DynamoDbClient;
use Aws\DynamoDb\Session\SessionHandler;
// DISCLAIMER: untested and should just be used as guideline
//
// Either fetches the required credentials from the ec2 server or requires to add them to a _ss_environment.php file
// AWS_REGION_NAME <- required
// AWS_DYNAMODB_SESSION_TABLE <- required
// AWS_SECRET_KEY
<?php
$dateFrom = DateTime::createFromFormat('d/m/Y', '03/11/2014');
$dateTo = DateTime::createFromFormat('d/m/Y', '02/01/2015');
$difference = $dateFrom->diff($dateTo);
// diff in years, months and years
echo $difference->y.' '.$difference->m.' '.$difference->d.PHP_EOL;
--- a/cwp/files/repos/deploynaut-lib/cwptasks.rb
+++ b/cwp/files/repos/deploynaut-lib/cwptasks.rb
@@ -5,26 +5,9 @@ namespace :deploy do
# We are deploying to both sides, signal to csync2 that we want it disabled, and wait for it to finish.
task :disable_csync do
run "touch #{deploy_to}/csync2.disable"
-
- # Check lock by trying to acquire it for one minute (36 checks, 5s delay).
- # Outer bash is needed for the loop to function correctly.
- begin
@stojg
stojg / coreos.json
Created November 14, 2014 04:48
CoreOS On AWS Cloudformation
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "CoreOS on EC2: http://coreos.com/docs/running-coreos/cloud-providers/ec2/",
"Mappings" : {
"RegionMap" : {
"eu-central-1" : { "AMI" : "ami-e8c6f0f5" },
"ap-northeast-1" : { "AMI" : "ami-858eb884" },
"sa-east-1" : { "AMI" : "ami-7b922666" },
"ap-southeast-2" : { "AMI" : "ami-13abc629" },
"ap-southeast-1" : { "AMI" : "ami-7e78592c" },