Skip to content

Instantly share code, notes, and snippets.

View anokun7's full-sized avatar
🎯
Focusing

Anoop Kumar anokun7

🎯
Focusing
View GitHub Profile
@anokun7
anokun7 / gist:9474a051937cdd712bdf
Last active September 10, 2015 19:27
To remove all docker images or containers directly from commandline
# Need to force
# Ideally run this after removing the containers so that the images are not being used
for i in $(docker images | tail -n +2 | awk '{ print $3 }'); do docker rmi -f $i ; done
# Need to stop the container before removing it
# Instead of 'docker stop', you can also run 'docker kill'.
for i in $(docker ps -a | tail -n +2 | awk '{ print $1 }'); do docker stop $i && docker rm $i ; done
@anokun7
anokun7 / gist:73617c485c54be8f4d54
Last active September 16, 2015 18:30
Swarm Issues
#### Known issues & lessons learned in Swarm:
1. When joining nodes to the cluster (using docker run -d swarm join --addr...), the = between addr is optional.
2. When joining nodes to the cluster (using docker run -d swarm join --addr...), do NOT use tcp:// after --addr.
3. When joining nodes to the cluster (using docker run -d swarm join --addr...), on AWS at least use only the DNS name after --addr.
4. tcp:// is required in the DOCKER_HOST env variable. [ e.g.: export DOCKER_HOST=tcp://<DNS-of-host>:9999 ]
5. In AWS at least, while setting environment variable DOCKER_HOST, use only the DNS hostname and not localhost even if you are on the swarm manager.

Keybase proof

I hereby claim:

  • I am anokun7 on github.
  • I am anoopkumar (https://keybase.io/anoopkumar) on keybase.
  • I have a public key whose fingerprint is 6F24 F698 3898 1A05 1AE5 7BF7 5391 CC75 FBEE 168D

To claim this, I am signing this object:

SANs: Subject Alternate Names
Service Discovery: A mapping between the logical ID of the container to a concrete (routable) IP:PORT pair must be established and maintained.
Zookeeper: ZooKeeper acts as the master election service in the Mesosphere architecture and stores state for the Mesos nodes.
To find if a node is a Leader or Follower (or Standalone), use the command below:
echo srvr | nc localhost 2181 | grep Mode
docker run -d -p 8888:2375 --name docker-swarm -e SWARM_MESOS_USER=root swarm manage -c mesos-experimental --cluster-opt mesos.address=0.0.0.0 --cluster-opt mesos.port=5050 zk://172.31.0.11:2181/mesos
@anokun7
anokun7 / 1.md
Created February 26, 2016 00:45
Uses of different knots
Overhand: When you just gotta tie a knot.
Double overhand: When you just gotta tie a knot but you don't trust a regular overhand because life is cruel to you.
Figure eight knot: When you need a strong as hell loop that 100% won't fail on you such as when you're climbing mountains or rock walls although anything dangerous like that you should be using a double figure eight.
Running knot: This is barely a knot. Use it to choke yourself while you masturbate in your broom closet you sick fuck.
Granny knot: This is what you get the first two times you try to tie a square knot and fuck it up.
Sheep shank: An actual knot EMSK. Use it to shorten rope. It doesn't take too much pressure but if you put another secure rope through those two end loops it can hold down a trailer load.
Square knot: Another knot EMSK. Turns two pieces of equally thick rope into one. Use it to tie together the ends of your ugly-ass shark tooth necklace.
Bowline: Every sailor knows this but you should definitely know too. You know in movie
version: "2"
services:
  voting-app:
      image: docker/example-voting-app-voting-app
      ports:
      - "80"
      networks:
      - votenet
 result-app:
docker-machine create -d virtualbox kv
docker $(docker-machine config kv) login
docker $(docker-machine config kv) run -d -p 8500:8500 -h consul progrium/consul -server -bootstrap
docker-machine create -d virtualbox --swarm --swarm-master --swarm-discovery="consul://$(docker-machine ip kv):8500" --engine-opt="cluster-store=consul://$(docker-machine
 ip kv):8500" --engine-opt="cluster-advertise=eth1:2376" swarm-manager
docker-machine create -d virtualbox --swarm --swarm-discovery="consul://$(docker-machine ip kv):8500" --engine-opt="cluster-store=consul://$(docker-machine ip kv):8500" -
-engine-opt="cluster-advertise=eth1:2376" node1
docker-machine create -d virtualbox --swarm --swarm-discovery="consul://$(docker-machine ip kv):8500" --engine-opt="cluster-store=consul://$(docker-machine ip kv):8500" --engine-opt="cluster-advertise=eth1:2376" node2
eval "$(docker-machine env --swarm swarm-manager)"
@anokun7
anokun7 / vim_on_mac.md
Last active May 6, 2016 23:35
Key mappings for copy paste from Vim on Mac (Yosemite)

Add these key mappings in ~/.vimrc

vmap <C-x> :!pbcopy<CR>
nmap <C-a> ggVG:w !pbcopy<CR><CR>
vmap <C-c> :w !pbcopy<CR><CR>

In visual selection mode, hit Ctrl-c to copy selected text. (Command key will never work within Vim) In visual selection mode, hit Ctrl-x to cut selected text. Hit Ctrl-a to copy the entire file contents in vim.

@anokun7
anokun7 / main.go
Created August 1, 2017 16:05 — forked from filewalkwithme/main.go
Listening multiple ports on golang http servers
package main
import (
"net/http"
)
func main() {
finish := make(chan bool)
server8001 := http.NewServeMux()
@anokun7
anokun7 / UCP-installation-aws.md
Created March 17, 2016 02:25
hands-free installation of UCP [aka Single command install] on aws
docker run -it --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v docker_subscription.lic:/docker_subscription.lic \
--name ucp docker/ucp install --fresh-install \
--san $(curl http://169.254.169.254/latest/meta-data/public-hostname)

The user id & password will default to admin/orca