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
    
  
  
    
  | with import <nixpkgs> { }; | |
| let | |
| pythonPackages = python37Packages; | |
| pythonVenvDir = ".local/${pythonPackages.python.name}"; | |
| envPackages = [ | |
| gettext | |
| gitMinimal | |
| ]; | |
| preInstallPypiPackages = [ | 
  
    
      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
    
  
  
    
  | [Unit] | |
| Description=Remove unused docker resources | |
| Documentation=https://docs.docker.com/v17.09/engine/admin/pruning/ | |
| After=docker.service | |
| [Service] | |
| Type=oneshot | |
| ExecStart=/usr/bin/docker system prune -f --filter "until=744h" | |
| ExecStart=/usr/bin/docker volume prune -f | 
  
    
      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
    
  
  
    
  | vzlist -o ctid -H | xargs -n 1 -I {} sh -c "vzctl stop {} && vzctl destroy {}" | 
  
    
      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
    
  
  
    
  | [alias] | |
| cleanup = "!git branch --merged | grep -v '\\*\\|master\\|develop\\|release' | xargs -n 1 git branch -d" | 
  
    
      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
    
  
  
    
  | set PYENV_ROOT $HOME/.pyenv | |
| set -x PATH $PYENV_ROOT/bin $PATH | |
| status --is-interactive; and . (pyenv init -|psub) | |
| status --is-interactive; and . (pyenv virtualenv-init -|psub) | |
| set -x VIRTUAL_ENV_DISABLE_PROMPT 1 | 
  
    
      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 ctypes | |
| import threading | |
| import time | |
| # inspired by https://github.com/mosquito/crew/blob/master/crew/worker/thread.py | |
| def kill_thread( | |
| thread: threading.Thread, exception: BaseException=KeyboardInterrupt | |
| ) -> None: | |
| if not thread.isAlive(): | 
  
    
      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 asyncio | |
| from functools import partial | |
| async def process(d): | |
| print('process', d) | |
| async def amain(loop): | |
| data = range(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
    
  
  
    
  | __obj = object() | |
| # uncomment for fix: | |
| # _Class__obj = __obj | |
| def func(): | |
| print('func:', __obj) | |
| class Class: | 
  
    
      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 Namespace: | |
| __slots__ = '_Namespace__names' | |
| def __init__(self, **items): | |
| self.__names = dict(**items) | |
| def __setattr__(self, key, value): | |
| if key in self.__slots__: | |
| super().__setattr__(key, value) | 
  
    
      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 itertools import combinations | |
| def combinations_dict(data): | |
| """ | |
| Generates all possible combinations of values for dictionary. | |
| At the entrance you can pass either dictionary or list of tuples. | |
| Examples:: | 
NewerOlder