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
curl -sSL https://agent.digitalocean.com/install.sh | sh | |
useradd user | |
usermod -aG sudo user | |
# ZSH | |
sudo apt-get install zsh -y | |
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh | |
chsh -s $(which 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
docker run -d --restart=unless-stopped --name rancher \ | |
-p 8000:80 -p 8443:443 \ | |
-v /host/rancher:/var/lib/rancher \ | |
rancher/rancher:latest |
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 Optional: | |
""" | |
>>> class User: | |
... def __init__(self, friend_a, friend_b): | |
... self.friend_a = friend_a | |
... self.friend_b = friend_b | |
... | |
... def calc(self): | |
... return 5 |
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
def synchronized_method(mutex_attr='mutex'): | |
def decorator(method): | |
@wraps(method) | |
def wrapped(instance, *args, **kw): | |
with getattr(instance, mutex_attr): | |
return method(instance, *args, **kw) | |
return wrapped | |
return decorator |
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 SequenceKeyWrapper(object): | |
""" | |
for bisect with key function | |
""" | |
def __init__(self, iterable, key): | |
self.iterable = iterable | |
self.key = key | |
def __getitem__(self, i): |
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
export ZSH=/Users/afonasev/.oh-my-zsh | |
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes | |
ZSH_THEME="amuse" | |
fpath+=~/.zfunc | |
autoload -U compinit && compinit | |
plugins=( | |
docker, git, django, colored-man, colorize, github, |
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
Show hidden characters
[ | |
{ "keys": ["ctrl+tab"], "command": "next_view" }, | |
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" }, | |
{ "keys": ["ctrl+t"], "command": "show_panel", "args": {"panel": "console", "toggle": true} }, | |
{ "keys": ["ctrl+alt+c"], "command": "exec", "args": {"kill": true} } | |
] |
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
{ | |
"auto_complete_commit_on_tab": true, | |
"auto_complete_triggers": | |
[ | |
{ | |
"characters": ".", | |
"selector": "source.python - string - comment - constant.numeric" | |
} | |
], | |
"bold_folder_labels": true, |
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
[user] | |
name = Afonasev Evgeniy | |
email = [email protected] | |
[ea] | |
afonasev = Afonasev Evgeniy | |
[core] | |
autocrlf = input | |
safecrlf = false | |
editor = /usr/bin/vim | |
pager = less |
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
def convert_timestamp_to_local_tz(dt): | |
if dt.tzinfo is None: | |
return dt | |
# convert to utc | |
utc_dt = dt - dt.utcoffset() | |
utc_dt = utc_dt.replace(tzinfo=None) | |
offset = ( | |
dt.datetime.now().replace(minute=0, second=0, microsecond=0) - |