Skip to content

Instantly share code, notes, and snippets.

@davebiffuk
davebiffuk / aws-linux-instance.py
Created December 23, 2014 15:54
start an AWS image, display the ssh command line to access it, and clean up afterwards
#!/usr/bin/python -u
import boto.ec2
import time
import subprocess
# debian-wheezy-amd64-pvm-2014-09-26-ebs - ami-3051f047
# ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-20140927 - ami-f0b11187
instance = "ami-3051f047"
conn = boto.ec2.connect_to_region("eu-west-1")
@davebiffuk
davebiffuk / days_left.py
Created January 19, 2016 16:27
print number of days' validity left for SSL certificate
#!/usr/bin/python3
# vi:ts=4:sw=4:ai:cindent
# reads the a .pem file (or stdin) and emits the number of days'
# validity remaining
import ssl
import OpenSSL.crypto
from datetime import datetime

Keybase proof

I hereby claim:

  • I am davebiffuk on github.
  • I am davebiff (https://keybase.io/davebiff) on keybase.
  • I have a public key whose fingerprint is D4A9 BBA2 14CF 41C9 5B89 5175 02D0 2045 08FB 0EF7

To claim this, I am signing this object:

@davebiffuk
davebiffuk / template-broken-wait.json
Created December 13, 2017 16:14
Packer template to demonstrate broken "<wait2m>" behaviour
{
"builders": [
{
"type": "qemu",
"iso_url": "http://dl-cdn.alpinelinux.org/alpine/v3.7/releases/x86_64/alpine-virt-3.7.0-x86_64.iso",
"iso_checksum": "5a4b2588afd32e7024dd61d9558b77b03a4f3189cb4c9fc05e9e944fb780acdd",
"iso_checksum_type": "sha256",
"ssh_username": "root",
"ssh_password": "{{user `root_password`}}",
"accelerator": "none",
ESC]0;dh3@maybe: ~/alpine-linux-image^Gdh3@maybe:~/alpine-linux-image$ PACKER_LOG=1 packer build template-broken-wait.j ^Mson
2017/12/13 16:13:14 [INFO] Packer version: 1.1.3
2017/12/13 16:13:14 Packer Target OS/Arch: linux amd64
2017/12/13 16:13:14 Built with Go Version: go1.9
2017/12/13 16:13:14 [DEBUG] Discovered plugin: amazon-chroot = /usr/local/bin/packer-builder-amazon-chroot
2017/12/13 16:13:14 [DEBUG] Discovered plugin: amazon-ebs = /usr/local/bin/packer-builder-amazon-ebs
2017/12/13 16:13:14 [DEBUG] Discovered plugin: amazon-instance = /usr/local/bin/packer-builder-amazon-instance
2017/12/13 16:13:14 [DEBUG] Discovered plugin: digitalocean = /usr/local/bin/packer-builder-digitalocean
2017/12/13 16:13:14 [DEBUG] Discovered plugin: docker = /usr/local/bin/packer-builder-docker
2017/12/13 16:13:14 [DEBUG] Discovered plugin: file = /usr/local/bin/packer-builder-file
@davebiffuk
davebiffuk / gist:dbb9ea59be4da51262b24294bdd25360
Created February 2, 2018 15:08
security group misbehaviour - TF_LOG=trace terraform apply
Script started on Fri 02 Feb 2018 15:00:27 GMT
]0;dh3@maybe: ~/terraform-playground/security-group-testsdh3@maybe:~/terraform-playground/security-group-tests$ (master) TF_LOG=trace terraform apply
2018/02/02 15:00:29 [INFO] Terraform version: 0.11.3 3802b14260603f90c7a1faf55994dcc8933e2069
2018/02/02 15:00:29 [INFO] Go runtime version: go1.9.1
2018/02/02 15:00:29 [INFO] CLI args: []string{"/home/dh3/bin/terraform", "apply"}
2018/02/02 15:00:29 [DEBUG] Attempting to open CLI config file: /home/dh3/.terraformrc
2018/02/02 15:00:29 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/02/02 15:00:29 [INFO] CLI command args: []string{"apply"}
2018/02/02 15:00:29 [INFO] command: empty terraform config, returning nil
2018/02/02 15:00:29 [DEBUG] command: no data state file found for backend config
@davebiffuk
davebiffuk / instance.tf
Created February 2, 2018 15:11
Terraform template for security group
variable "count" {
default = 1
}
variable "flavor" {
default = "m1.small"
}
resource "openstack_networking_floatingip_v2" "fip" {
count = "${var.count}"
@davebiffuk
davebiffuk / gist:40ee5a4375dd02547d9c6620233861d5
Created February 12, 2018 15:03
security group misbehaviour with OpenStack provider debug
2018/02/12 14:58:02 [INFO] Terraform version: 0.11.3 3802b14260603f90c7a1faf55994dcc8933e2069
2018/02/12 14:58:02 [INFO] Go runtime version: go1.9.1
2018/02/12 14:58:02 [INFO] CLI args: []string{"/home/dh3/bin/terraform", "apply"}
2018/02/12 14:58:02 [DEBUG] Attempting to open CLI config file: /home/dh3/.terraformrc
2018/02/12 14:58:02 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/02/12 14:58:02 [INFO] CLI command args: []string{"apply"}
2018/02/12 14:58:02 [INFO] command: empty terraform config, returning nil
2018/02/12 14:58:02 [DEBUG] command: no data state file found for backend config
2018/02/12 14:58:02 [DEBUG] New state was assigned lineage "5a7f490e-fe4a-4f96-b18f-f1f950b851cd"
2018/02/12 14:58:02 [INFO] command: backend initialized: <nil>
@davebiffuk
davebiffuk / log
Created July 2, 2020 13:14
Terraform debug output failing to create openstack_lb_loadbalancer_v2
2020/07/02 12:02:14 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility.
Use TF_LOG=TRACE to see Terraform's internal logs.
----
2020/07/02 12:02:14 [INFO] Terraform version: 0.12.28
2020/07/02 12:02:14 [INFO] Go runtime version: go1.12.13
2020/07/02 12:02:14 [INFO] CLI args: []string{"/nfs/users/nfs_d/dh3/bin/terraform", "apply"}
2020/07/02 12:02:14 [DEBUG] Attempting to open CLI config file: /nfs/users/nfs_d/dh3/.terraformrc
2020/07/02 12:02:14 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/07/02 12:02:14 [INFO] CLI command args: []string{"apply"}
2020/07/02 12:02:14 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility.