Skip to content

Instantly share code, notes, and snippets.

@phrawzty
phrawzty / extant_infra_terraform.md
Last active June 16, 2017 00:40
Dealing with extant AWS resources in Terraform

What it is

Problem: Terraform doesn't play nicely with pre-existing infrastructure.

Solution: Officially there isn't one - but here's a work-around that does the trick.

Summary

  • Declare a new, temporary resource in your Terraform plan that is nearly identical to the extant resource.
  • Apply the plan, thus instantiating the temporary "twinned" resource and building a state file.
@crhan
crhan / operating_system.rb
Last active September 12, 2016 15:10
rbenv.spec
module Gem
class << self
##
# Returns full path of previous but one directory of dir in path
# E.g. for '/usr/share/ruby', 'ruby', it returns '/usr'
def previous_but_one_dir_to(path, dir)
split_path = path.split(File::SEPARATOR)
File.join(split_path.take_while { |one_dir| one_dir !~ /^#{dir}$/ }[0..-2])
@alperkokmen
alperkokmen / pd-event.sh
Last active April 6, 2024 20:39
Simple script to trigger, acknowledge, and resolve incidents via PagerDuty Integration API.
#!/bin/bash
CONTENT_TYPE="application/json"
DESCRIPTION="bad things™ are happening"
URL="https://events.pagerduty.com/generic/2010-04-15/create_event.json"
if [ $# -ne 3 ]; then
echo "Usage: pd-event.sh [TYPE] [SERVICE KEY] [INCIDENT KEY]"
echo " - TYPE: [t]rigger | [a]cknowledge | [r]esolve"
echo " - SERVICE KEY: unique identifier for service"
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@scottslowe
scottslowe / lxc-ovsup
Created January 22, 2014 23:14
This script can be used to automatically attach LXC instances to Open vSwitch (OVS) on startup. You'll need to call this script from the container's configuration using the "lxc.network.script.up" configuration parameter.
#!/bin/bash
BRIDGE="br-int"
ovs-vsctl --may-exist add-br $BRIDGE
ovs-vsctl --if-exists del-port $BRIDGE $5
ovs-vsctl --may-exist add-port $BRIDGE $5
@davidillsley
davidillsley / gist:7481319
Last active December 28, 2015 09:48
Accessing EMC Atmos using S3 tooling

Accessing EMC Atmos using S3 tooling

There are loads of tools out there built around the AWS APIs. In response to that, some software comes with an AWS compatibility layer. One of them is EMC Atmos.

There's a surprising lack of documentation on how to actually use this compatibility. The best I could find is the "EMC® Atmos™ Version 2.1 Programmer’s Guide P/N 300-013-493 REV 01". However, all it does it tell you that the S3 compatibility is hosted on a different port, and which operations are supported. It doesn't give any hints on how to get any tools working.

The main gotcha seems to be that the S3 API has both a path and DNS based way of accessing buckets. It's important to use the path based mechanism.

JetS3t

@jwalton
jwalton / REAMDE.md
Last active March 27, 2020 10:28 — forked from james/REAMDE.md
Pingdom widget for Dashing

Description

Simple Dashing widget (and associated job) to display Pingdom checks.

##Dependencies

rest-client

Add it to dashing's gemfile:

@mavimo
mavimo / Readme.md
Last active March 11, 2023 09:22 — forked from steintore/Readme.md

Description

Dashing widget to display a Jenkins build status and build progress

The widget is based on the meter-widget which is default in the Dashing installation

The widget can also see the progress of a "pre-build", i.e if you have a job triggering the actual build you want to define, you can configure this job in the jenkins_build.rb as a prebuild.

For more information, please see Coding Like a tosser

@miohtama
miohtama / gist:5216738
Created March 21, 2013 21:05
Enabling SSLCACertificateFile and SSLVerifyClient for one page only in Apache 2.2+
# Apache configuration for running local browser against a locally running xxxx for manual smartcard testing
# Listen 4433
<VirtualHost 127.0.0.1:4433>
# Real men use mod_proxy
DocumentRoot "/nowhere"
ServerName local-apache
ServerAdmin you@example.com
@EHadoux
EHadoux / Readme.md
Last active May 18, 2016 10:07
Sonar Widget for Dashing

Description

This is a dashing widget intended to show metrics from a sonar repository.

Usage

This widget currently uses the list widget as a view. You just have to add this snippet to your dashboard: