Skip to content

Instantly share code, notes, and snippets.

@DALDEI
DALDEI / packer.json
Created September 15, 2017 02:22
packer-push bug input
{ "variables": {
"amznrepo" : "file:///var/repo",
"version" : "1.0",
"repository" : "nexstra/createrepo",
"baseImage" : "amazonlinux:latest",
"yumrepo" : "",
"amznrepo" : "/space/amazonlinux/repo",
"yumrepod" : "{{pwd}}/../yum.repos.d",
"awsEcr" : "{{env `AWS_ECR`}}",
"doEcrLogin" : "true"
@DALDEI
DALDEI / packer-log
Created September 15, 2017 02:21
packer docker-push error
2017/09/14 22:19:50 [INFO] Packer version: 1.1.0
2017/09/14 22:19:50 Packer Target OS/Arch: linux amd64
2017/09/14 22:19:50 Built with Go Version: go1.9
2017/09/14 22:19:50 Detected home directory from env var: /home/dlee
2017/09/14 22:19:50 Using internal plugin for alicloud-ecs
2017/09/14 22:19:50 Using internal plugin for amazon-ebs
2017/09/14 22:19:50 Using internal plugin for azure-arm
2017/09/14 22:19:50 Using internal plugin for lxc
2017/09/14 22:19:50 Using internal plugin for vmware-vmx
2017/09/14 22:19:50 Using internal plugin for file
@DALDEI
DALDEI / yq
Created June 2, 2017 20:12 — forked from earonesty/yq
#!/bin/env python
import yaml
import sys
import json
import argparse
from subprocess import Popen, PIPE
import argparse
import os
@DALDEI
DALDEI / keybase.md
Created April 10, 2017 11:54
keybase.md

Keybase proof

I hereby claim:

  • I am daldei on github.
  • I am daldei (https://keybase.io/daldei) on keybase.
  • I have a public key ASD7e_4q1N0JwG5DSbdZUhLTg99I8tJ3ng60y-Uxd2eRJAo

To claim this, I am signing this object:

@DALDEI
DALDEI / .bashrc
Last active February 2, 2018 11:50 — forked from miracle2k/.bashrc
Convert an existing docker container into a "docker run" command line
# Convert an existing docker container into a "docker run" command line.
#
# This is useful when trying to debug containers that have been created
# by orchestration tools.
#
# Install jq: stedolan.github.io/jq/
# Improved version that handles ports, volumes, binds
function format_run() {
cid=$1
@DALDEI
DALDEI / docker-volume-funcs.sh
Created March 19, 2017 23:26
Backup/Restore Docker Volumes
# backup files from a docker volume into /tmp/backup.tar.gz
# from http://stackoverflow.com/questions/21597463/how-to-port-data-only-volumes-from-one-host-to-another
function docker-volume-backup-compressed() {
docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -czvf /backup/backup.tar.gz "${@:2}"
}
# restore files from /tmp/backup.tar.gz into a docker volume
function docker-volume-restore-compressed() {
docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:2}"
echo "Double checking files..."
docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie ls -lh "${@:2}"
@DALDEI
DALDEI / HTTPServer.java
Created March 12, 2017 12:49
Minimal HTTP Server using com.sun.net.httpserver.HttpServer
// from: http://www.rgagnon.com/javadetails/java-have-a-simple-http-server.html
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
/*
@DALDEI
DALDEI / Server.java
Created March 11, 2017 03:01
Minimal Java Web server with no dependencies
// from: http://stackoverflow.com/questions/3732109/simple-http-server-in-java-using-only-java-se-api
import java.io.*;
import javax.xml.ws.*;
import javax.xml.ws.http.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
@WebServiceProvider
@ServiceMode(value = Service.Mode.PAYLOAD)
public class Server implements Provider<Source> {
@DALDEI
DALDEI / findawsami.sh
Created February 16, 2017 04:58
Locate the latest published AWS EC2 AMI with AWS Linux, base AMI, HVM, EBS boot partition, latest kernal. 1-liner.
#!/bin/bash
aws ec2 describe-images --owners amazon --filters "Name=state,Values=available" \
"Name=architecture,Values=x86_64" \
"Name=root-device-type,Values=ebs" \
"Name=virtualization-type,Values=hvm" \
"Name=block-device-mapping.volume-type,Values=gp2" \
"Name=hypervisor,Values=xen" \
--query 'Images[?Description!=null]|[?contains(Description,`Amazon Linux`) == `true`]|\
[?contains(Description,` NAT `)==`false`]|[?contains(Description,` ECS `)==`false`]|\
sort_by(@, &CreationDate)[-1]'
@DALDEI
DALDEI / docker-bridge-notes.txt
Created October 5, 2016 01:32
docker - change default bridge netowrk
Docker defauilts to taking over netowrks 172.17.0.0.
If this conflicts with other tools such as a VPN which you cannot control,
you can change the default bridge. This is easier if you have never started docker.
You wouldnt be reading this if that were the case.
So how to get out of the mess ?
# Bug reports / rfc
https://github.com/docker/docker/issues/8696
# Set the ip of the Docker bridge with Systemd