https://github.com/kislyuk/argcomplete
argcomplete - Bash tab completion for argparse Tab complete all the things!
Argcomplete provides easy, extensible command line tab completion of arguments for your Python script.
It makes two assumptions:
| #!/usr/bin/env python | |
| """Extract a session from the IPython input history. | |
| """ | |
| import sys | |
| import codecs | |
| from IPython.core.history import HistoryAccessor | |
| class MyHistoryAccessor(HistoryAccessor): | |
| """ Modified HistoryAccessor to fetch the whole ipython history across all sessions """ |
| #!/usr/bin/env bash | |
| # Saves todays ipython history to textfile. | |
| # Needs inotify-tools, sqlite3 | |
| HISTORY_SQLITE="${HOME}/.config/ipython/profile_default/history.sqlite" | |
| HISTORY_FILE="${HOME}/.config/ipython/profile_default/history.py" | |
| if [ ! -f "${HISTORY_FILE}" ]; then | |
| touch "${HISTORY_FILE}" | |
| fi |
https://github.com/kislyuk/argcomplete
argcomplete - Bash tab completion for argparse Tab complete all the things!
Argcomplete provides easy, extensible command line tab completion of arguments for your Python script.
It makes two assumptions:
| #!/usr/bin/env python | |
| # Parse Icinga object cache file into proper data structure | |
| import re | |
| import logging | |
| logger = logging.getLogger(__name__) | |
| def parse_config(cache_file): | |
| """ |
| import subprocess | |
| logger = logging.getLogger(__name__) | |
| def ssh_tunnel(jumphost, remote_server, local_port, remote_port, | |
| control_socket='/tmp/ssh_socket'): | |
| """ | |
| Establish SSH tunnel | |
| :param jumphost: jump host |
| #!/usr/bin/env python | |
| # | |
| # Show URL of file in git, optionally open URL in browser. | |
| # In contrast to 'hub' this works to Github *and* Gitlab. | |
| # | |
| # Requirements: GitPython, click | |
| import logging | |
| import os | |
| import sys | |
| import webbrowser |
| # Required: boltons, nested_dict | |
| from boltons.iterutils import remap | |
| from nested_dict import nested_dict | |
| def ndict(data): | |
| """ | |
| Create a defaultdict-like dictionary that allows accessing nested keys without getting | |
| KeyErrors or TypeErrors. | |
| Regular dict: |
| # Gets or sets popularimeter ID3 rating tag for Traktor. | |
| # Needs mutagen for ID3 tag manipulation: | |
| # pip install mutagen | |
| import logging | |
| import os | |
| import sys | |
| import click | |
| import mutagen | |
| import mutagen.id3 |
| FROM ubuntu:latest | |
| RUN apt-get update --fix-missing | |
| RUN apt-get install -y git make g++ libsndfile1-dev libpng++-dev libpng12-dev libboost-program-options-dev | |
| RUN apt-get install -y libxvidcore4 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-alsa gstreamer1.0-fluendo-mp3 gstreamer1.0-libav | |
| RUN git clone https://github.com/beschulz/wav2png | |
| WORKDIR /wav2png/build | |
| RUN make all | |
| RUN ln -s /wav2png/bin/Linux/wav2png /usr/bin/wav2png |
| # | |
| # Fetches latest MYSQL dump from radio-browser.info, converts it to SQLite. | |
| # Usage: | |
| # docker build -t radiobrowser-converter . | |
| # docker run -v $PWD:/temp -it --rm radiobrowser-converter | |
| # | |
| FROM mysql:latest | |
| RUN apt-get update | |
| RUN apt-get install -y rubygems ruby-mysql2 wget build-essential libmysqlclient-dev ruby2*-dev sqlite3 libsqlite3-dev | |
| RUN gem install sequel mysql2 sqlite3 |