Skip to content

Instantly share code, notes, and snippets.

View QuingKhaos's full-sized avatar

Em Karisch QuingKhaos

View GitHub Profile
@QuingKhaos
QuingKhaos / post-merge
Created August 23, 2017 06:46
git hook to run a command after `git pull` if a specified file was changed
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@QuingKhaos
QuingKhaos / supply.md
Last active June 27, 2017 13:53
Event Storming supply list for Austria
@QuingKhaos
QuingKhaos / 10-acme.tf
Created May 5, 2017 11:51
Terraform cross account additions of AWS organizational root account
data "aws_iam_policy_document" "acme_crossaccount_administrator" {
statement {
sid = "acme"
actions = ["sts:AssumeRole"]
resources = [
"${aws_iam_role.acme_operations_administrator.arn}",
]
}
provider = "aws.acme"
@QuingKhaos
QuingKhaos / 15-acme-operations.tf
Last active August 8, 2020 18:56
Terraform initialization of AWS sub account
// Configure AWS provider
variable "acme_operations" {
default = "ACCOUNTID"
}
provider "aws" {
alias = "acme_operations"
profile = "acme_operations"
region = "${var.aws_default_region}"
shared_credentials_file = "./credentials"
@QuingKhaos
QuingKhaos / TerraformInitCrossAccountPolicy.json
Last active May 5, 2017 13:24
AWS TerraformInit policy addition for cross account access
{
"Effect": "Allow",
"Action": [
"iam:CreatePolicy",
"iam:GetPolicy",
"iam:GetPolicyVersion",
"iam:CreatePolicyVersion",
"iam:ListPolicyVersions"
],
"Resource": [
@QuingKhaos
QuingKhaos / 00-defaults.tf
Last active February 21, 2020 12:21
Terraform initialization of AWS organizational root account, prepared for multiple accounts
variable "aws_default_region" {
default = "eu-west-1"
}
variable "administrator_default_arn" {
default = "arn:aws:iam::aws:policy/AdministratorAccess"
}
variable "developer_default_arn" {
default = "arn:aws:iam::aws:policy/PowerUserAccess"
@QuingKhaos
QuingKhaos / TerraformInitOneLoginPolicy.json
Last active May 5, 2017 11:34
AWS TerraformInit policy with OneLogin
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:CreateAccountAlias",
"iam:ListAccountAliases",
"iam:DeleteAccountAlias"
],
@QuingKhaos
QuingKhaos / github-merge.sh
Last active February 3, 2018 23:46
Script to merge GitHub pull requests remotely, while inspecting & signing them.
#!/bin/bash
# This script will locally construct a merge commit for a pull request on a
# github repository, inspect it, sign it and optionally push it.
# The following temporary branches are created/overwritten and deleted:
# * pull/$PULL/base (the current master we're merging onto)
# * pull/$PULL/head (the current state of the remote pull request)
# * pull/$PULL/merge (github's merge)
# * pull/$PULL/local-merge (our merge)
@QuingKhaos
QuingKhaos / _section.html
Last active November 2, 2016 11:30
Section template for https://github.com/slara/generator-reveal which allows multiple slides in one markdown file
<% if (!_.isString(slide) && !_.isArray(slide) && _.isObject(slide)) { %>
<section <%= _.map(slide.attr, function (val, attr) {return attr + '="' + val + '"'}).join(' ')%> <% if (_.isString(slide.filename)) { %>data-<% if (slide.filename.indexOf('.html') !== -1) { %>html<% } else { %>markdown<% }%>="slides/<%= slide.filename %>"<% } %>
<% } %><% if (_.isString(slide)) { %>
<section data-<% if (slide.indexOf('.html') !== -1) { %>html<% } else { %>markdown<% }%>="slides/<%= slide %>"
<% } %>
data-separator="^\n\n\n"
data-separator-vertical="^\n\n"
data-separator-notes="^Note:"
></section>
@QuingKhaos
QuingKhaos / WebsiteController.php
Last active August 3, 2016 11:52
Resolving the parent and next sibling page of a Sulu content page
<?php
namespace Client\Bundle\WebsiteBundle\Controller;
use Sulu\Bundle\WebsiteBundle\Controller\WebsiteController as BaseWebsiteController;
use Sulu\Component\Content\Compat\Structure\PageBridge;
use Sulu\Component\Content\Compat\StructureInterface;
use Sulu\Component\Util\SortUtils;
use Symfony\Component\HttpFoundation\Response;