Skip to content

Instantly share code, notes, and snippets.

View stojg's full-sized avatar

Stig Lindqvist stojg

View GitHub Profile
@stojg
stojg / server-status.conf
Last active August 29, 2015 14:11
server-status.conf
Listen 81
<VirtualHost *:81>
ServerName localhost
<Location />
<IfModule mod_status.c>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost ip6-localhost 127.0.0.0/255.0.0.0
@stojg
stojg / consul
Created December 1, 2014 04:51
consul service init script for debian
#!/bin/sh
### BEGIN INIT INFO
# Provides: consul
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: Consul service discovery framework
# Description: Healthchecks local services and registers
# them in a central consul database.
@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" },
--- 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
<?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;
@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
@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 / 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
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"Stmt9dsun432j",
"Effect":"Allow",
"Action":[
"elasticloadbalancing:CreateLBCookieStickinessPolicy",
"elasticloadbalancing:SetLoadBalancerPoliciesOfListener",
"elasticloadbalancing:DescribeInstanceHealth",
---
- hosts: all
sudo: yes
tasks:
- apt: pkg={{ item }} state=latest
with_items:
- vim
- git
- tar
- apache2