Skip to content

Instantly share code, notes, and snippets.

@vindir
vindir / Docker-find-dependent-child-image.md
Created October 24, 2017 17:16 — forked from Siva-Charan/Docker-find-dependent-child-image.md
Docker: How to find the dependent child images?

Find the dependent child images on Docker

When you try to remove the docker image with the following command

docker rmi 6795374be8c1

Sometimes you might be facing below error:

Error response from daemon: conflict: unable to delete 6795374be8c1 (cannot be forced) - image has dependent child images

Below is the Docker command line used to find the dependent child images

@vindir
vindir / curl.md
Created October 19, 2017 17:57 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@vindir
vindir / simulateSlowMongod.sh
Created June 20, 2017 13:57 — forked from aheckmann/simulateSlowMongod.sh
simulate high latency replica sets (mac)
# first set up a pipe named "2" with bandwidth
# limited to 16kbit/s and latency of 100ms
sudo ipfw pipe 2 config bw 16Kbit/s delay 100ms
# next add rule #1 using the pipe we set up, configured to
# act only on local tcp traffic going to port 27019
sudo ipfw add 1 pipe 2 tcp from me to me 27019 out
# now you should be observing slow ping times for
# mongod on 27019
@vindir
vindir / Mac SSH Autocomplete
Created February 21, 2017 20:28 — forked from aliang/Mac SSH Autocomplete
Add auto complete to your ssh, put into your .bash_profile
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
@vindir
vindir / ec2_tags.py
Created February 17, 2017 16:11 — forked from emilisto/ec2_tags.py
Grain for Salt that exposes all EC2 instance tags in grains['tags'], free for all to use and distribute. Tweet me @svammel if you have questions.
"""
ec2_tags - Exports all EC2 tags in a 'tags' grain
For Salt (http://saltstack.org)
Author: Emil Stenqvist <[email protected]>
Usage:
1. Put ec2_tags.py in roots/_grains/
@vindir
vindir / gist:5b8bafd8cdc632747d0a57c6450b57ef
Created December 28, 2016 20:26 — forked from mdfGit/gist:48721c7cc0a9f18f27e7
AWS CloudFormation Mappings to Amazon NAT AMIs by Region/Instance type... Not sure why this doesn't already exist, but there were no example templates that mapped regions and instance types to the Amazon configured NAT ami. That's what this Gist is for, it provides the mappings for amzn-ami-vpc-nat amis in each region. These instances are config…
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation Template (SNIPPET) that maps Amazon NAT amis (amzn-ami-vpc-nat) for each region and architecture. These instances should have the NAT configured by /usr/local/sbin/configure-pat.sh, which enables IP forwarding and adds masquerading to iptables. IMPORTANT, when defining your EC2 instance as a NAT, make sure the 'SourceDestCheck': property is set to false. Otherwise, traffic through the NAT may not work. This setting allows the NAT to forward network traffic - it is not the recipient of the traffic.",
"Mappings": {
"AWSInstanceType2Arch": {
"t1.micro": {
"Arch": "PV64"
},
"t2.micro": {
"Arch": "HVM64"

"Briefly stated, the Gell-Mann Amnesia effect is as follows. You open the newspaper to an article on some subject you know well. In Murray's case, physics. In mine, show business. You read the article and see the journalist has absolutely no understanding of either the facts or the issues. Often, the article is so wrong it actually presents the story backward—reversing cause and effect. I call these the "wet streets cause rain" stories. Paper's full of them. In any case, you read with exasperation or amusement the multiple errors in a story, and then turn the page to national or international affairs, and read as if the rest of the newspaper was somehow more accurate about Palestine than the baloney you just read. You turn the page, and forget what you know." -Michael Crichton

@vindir
vindir / gen.swift
Created November 16, 2016 04:32 — forked from blainerothrock/gen.swift
A Very Simple Genetic Algorithm Written in Swift 3
#!/usr/bin/env xcrun swift -O
/*
gen.swift is a direct port of cfdrake's helloevolve.py from Python 2.7 to Swift 3
-------------------- https://gist.github.com/cfdrake/973505 ---------------------
gen.swift implements a genetic algorithm that starts with a base
population of randomly generated strings, iterates over a certain number of
generations while implementing 'natural selection', and prints out the most fit
string.
The parameters of the simulation can be changed by modifying one of the many
@vindir
vindir / HaProxy Circuit Breaker
Created November 14, 2016 20:42
HaProxy circuit-breaker-like setup
frontend my_frontend
bind *:443
acl is_my_frontend hdr(host) -i my_frontend.company.com
use_backend my_backend_cluster if is_my_frontend
backend my_frontend_cluster
balance roundrobin
option httpchk GET /health
default-server error-limit 3 on-error mark-down
server 192.168.10.1 weight 1 observe layer7
@vindir
vindir / context.xml
Last active November 8, 2016 15:28
Dump Tomcat Sessions Between Restarts
<Manager pathname="">
<saveOnRestart>false</saveOnRestart>
</Manager>
// Alternatively on Tomcat7
<Manager pathname="" />