mkdir -p ~/.oh-my-zsh/plugins/docker/curl -fLo ~/.oh-my-zsh/plugins/docker/_docker https://raw.githubusercontent.com/docker/cli/master/contrib/completion/zsh/_docker- Add
dockertopluginssection in~/.zshrc exec zsh
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
| s1 = u'ÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚÝàáâãèéêìíòóôõùúýĂăĐđĨĩŨũƠơƯưẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹ' | |
| s0 = u'AAAAEEEIIOOOOUUYaaaaeeeiioooouuyAaDdIiUuOoUuAaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUuYyYyYyYy' | |
| def remove_accents(input_str): | |
| s = '' | |
| print input_str.encode('utf-8') | |
| for c in input_str: | |
| if c in s1: | |
| s += s0[s1.index(c)] | |
| else: | |
| s += c |
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
| _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 "\[" ; |
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
| /* | |
| Состояние — это поведенческий паттерн проектирования, который позволяет объектам менять поведение в зависимости | |
| от своего состояния. Основная идея в том, что программа может находиться в одном из нескольких состояний, которые | |
| всё время сменяют друг друга. Набор этих состояний, а также переходов между ними, предопределён и конечен. | |
| Находясь в разных состояниях, программа может по-разному реагировать на одни и те же события, которые происходят с ней. | |
| Такой подход можно применить и к отдельным объектам. Например, объект Документ может принимать три состояния: Черновик, | |
| Модерация или Опубликован. В каждом из этих состоянии метод опубликовать будет работать по-разному. | |
| */ | |
| class TrafficLight { |
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
| function Stateful(object, initialState, interfaces, onInitialize) { | |
| var currentState; | |
| this.interfaces = interfaces = interfaces || object.constructor.States; | |
| if (typeof interfaces == "undefined") { | |
| throw "An object with the set of interfaces for each state is required"; | |
| } | |
| function trigger() { | |
| if (typeof object.trigger == "function") { |
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
| exports.RunObserver = () => { | |
| /** | |
| * Subject could be anything, Whatsapp group, Circket feed, news letter | |
| * notification | |
| */ | |
| var Subject = function () { | |
| //List of subscribers | |
| this.observers = []; | |
| return { |
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
| class Observer { | |
| constructor(state) { | |
| this.state = state; | |
| this.subscribers = []; | |
| } | |
| get() { | |
| return this.state; | |
| } |
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
| /** | |
| * Observer.js | |
| * This is a program to implement the Observer pattern in JavaScript. | |
| */ | |
| /** | |
| * The Subject "class" constructor. | |
| */ | |
| var Subject = function () { |
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
| import hmac | |
| from hashlib import sha1 | |
| from django.conf import settings | |
| from django.http import HttpResponse, HttpResponseForbidden, HttpResponseServerError | |
| from django.views.decorators.csrf import csrf_exempt | |
| from django.views.decorators.http import require_POST | |
| from django.utils.encoding import force_bytes | |
| import requests |