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 / 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
@anokun7
anokun7 / dtr.md
Last active January 19, 2020 06:47
Installing DTR on Ubuntu / Debian
wget -qO- 'https://pgp.mit.edu/pks/lookup?op=get&search=0xee6d536cf7dc86e2d7d56f59a178ac6c6238f52e' | sudo apt-key add --import
sudo apt-get update && sudo apt-get install apt-transport-https
sudo apt-get install -y linux-image-extra-virtual
sudo apt-get install -y linux-image-extra-$(uname -r)
sudo reboot
echo "deb https://packages.docker.com/1.9/apt/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update && sudo apt-get install docker-engine
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

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:

@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.
Debian / Ubuntu: /etc/default/docker
To restart (Ubuntu 14): service docker restart
CentOS: /etc/sysconfig/docker
To restart (on Centos 7.1): sudo systemctl restart docker.service
Windows:
@anokun7
anokun7 / gist:805f2c74189757dea00e
Created August 26, 2015 21:57
Docker Trusted Registry - Initial login
DTR uses SSL certificates in addition to a login/password to login.
The steps to use openssl to create a self-signed certificate as below:
1. First create a private key (myserver.key) and a certificate signing request (server.csr)
openssl req -nodes -newkey rsa:2048 -keyout myserver.key -out server.csr
2. Finally create the SSL certificate (server.crt) using the csr and private key just created:
openssl x509 -req -days 365 -in server.csr -signkey myserver.key -out server.crt
While running the following command, you may see this error:
`docker push anoop/webapp`
To fix this, run
`docker images`
Get the image id of the repository that you want to push.
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
web_web latest 4b81006810f8 2 hours ago 348.6 MB
@anokun7
anokun7 / gist:180346d8c4bf4a56d8f0
Created August 21, 2015 17:54
To expose a port on a running container
# Run this on the docker host (of course)
# Here I am exposing port 8080 on the container whose IPAddress is 172.17.0.113
#> as port 8888 on the docker host
# To get the container's IPAddress, use `docker inspect <containerid> | grep IPAddress
# To get the docker host's ip address and ssh into it, use:
# `docker-machine ssh $(docker-machine ls -q)`
iptables -t nat -A DOCKER -p tcp --dport 8888 -j DNAT --to-destination 172.17.0.113:8080
export PS1='\[\e[4;32m\]\!\[\e[m\] \[\e[0;31m\]\[\e[47m\]\u\[\e[m\] \[\e[1;37m\]\w\[\e[m\] \[\e[0;93m\][$?]\[\e[m\] \[\e[1;31m\]\$ \[\e[m\]\[\e[m\]\[\e[0;32m\]'
eg:
517 anoop ~ [0] $ cat aa
cat: aa: No such file or directory
518 anoop ~ [1] $