Python

Oneliners

HTTP

Start a webserver that hosts the current pwd.

Python2 Python3
python -m SimpleHTTPServer 8000 python3 -m http.server 8000

FTP

Start a ftp that hosts the current pwd, allows writing and is protected by a username/password.

Install

pip3 install pyftpdlib

Python2 Python3
python -m pyftpdlib -p 21 -w --user=username --password=password python3 -m pyftpdlib -p 21 -w --user=username --password=password

unicode character

Print a unicode character

Python2 Python3
python -c "print unichr(234)" python3 -c "print(chr(234))"

Handystuff

get current function name

functionname = inspect.stack()[0][3]

get callers name of current function

functionname = inspect.stack()[1][3]

Files