Skip to content

Instantly share code, notes, and snippets.

View vi4m's full-sized avatar
:atom:
coding

✪ vi4m Marcin Kliks vi4m

:atom:
coding
View GitHub Profile

Beautifull function decorator

Write decorator which prints function arguments and result. When decorated on given function with arbitrary number of arguments, invocation of this function should print-out arguments, and the result.

    @deco
    def sum_(x, y):
        return x + y
@vi4m
vi4m / gist:5276eb9c4442b787aad9
Last active August 29, 2015 14:06
Konfiguracja edytor pod pythona

VIM

cat ~/.vim/ftplugin/python.vim

set tabstop=8 
set expandtab 
set shiftwidth=4 
syntax on
set autoindent
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@vi4m
vi4m / gist:5748434
Last active December 18, 2015 07:39
Pomysły na salkę wpisujcie miasta!
(ralph)ralph@assets-www:~/lib$ pip freeze
Django==1.4.2
Jinja2==2.6
MySQL-python==1.2.3
Pillow==1.7.8
PyYAML==3.10
Pygments==1.6
SQLAlchemy==0.7.8
South==0.7.6
Sphinx==1.1.3
import datetime
results = {}
from rq import Queue, use_connection
class InProgressException(Exception):
pass
def test(*args, **kwargs):
@vi4m
vi4m / gist:4554591
Last active December 11, 2015 05:48

Ralph shell

UF options

  • dir()
  • autocompletion - po ewaluacji
  • root

Jak wyszukiwac obiekty wg atrybutow?

  • Po Primary Key
@vi4m
vi4m / puppet.py
Created December 10, 2012 14:07
deployment
@plugin.register(chain='deployment', requires=[], priority=0)
def puppet(deployment_id):
if not settings.PUPPET_DB_URL:
return True
deployment = Deployment.objects.get(id=deployment_id)
return deployment.puppet_certificate_revoked