This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| for d in `docker ps -aq`; do | |
| d_name=`docker inspect -f {{.Name}} $d` | |
| echo "=========================================================" | |
| echo "$d_name ($d) container size:" | |
| sudo du -d 2 -h /var/lib/docker/aufs | grep `docker inspect -f "{{.Id}}" $d` | |
| echo "$d_name ($d) volumes:" | |
| for mount in `docker inspect -f "{{range .Mounts}} {{.Source}}:{{.Destination}} | |
| {{end}}" $d`; do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # It works on RedHat, OEL, Centos | |
| curl -o /usr/bin/rlwrap https://dl.dropboxusercontent.com/u/21373460/rlwrap_static_x64 && chmod 755 /usr/bin/rlwrap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| cp /etc/apt/sources.list /etc/apt/sources.list_bkp | |
| sed -ri 's/\/\/\w+\.ubuntu\.com/\/\/mirror\.yandex\.ru/' /etc/apt/sources.list | |
| # OR | |
| cat /etc/apt/sources.list | \ | |
| python -c 'import re,sys; sys.stdout.write(re.sub(sys.argv[1], sys.argv[2], sys.stdin.read()))' \ | |
| '//\w+\.ubuntu\.com' '//mirror.yandex.ru' > /etc/apt/sources.list1 | |
| mv /etc/apt/sources.list1 /etc/apt/sources.list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| my_sed() { | |
| python -c 'import re,sys; sys.stdout.write(re.sub(sys.argv[1], sys.argv[2], sys.stdin.read()))' "$1" "$2" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from IPython.core.magic import (register_line_magic, register_cell_magic, | |
| register_line_cell_magic) | |
| from six import string_types | |
| class T(list): | |
| def _repr_html_(self): | |
| html = [u"<table>"] | |
| for row in self: | |
| html.append(u"<tr>") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Python 3 | |
| import random | |
| import string | |
| ''.join(random.choice(string.ascii_letters + string.digits + '#$-=_') for n in range(32)) | |
| # Python 2 | |
| import random | |
| import string | |
| ''.join([random.choice(string.ascii_letters + string.digits + '#$-=_') for n in xrange(32)]) |
NewerOlder