| title | Docker Compose Cheatsheet |
|---|---|
| subtitle | Quick reference for Docker Compose commands and config files |
| author | Jon LaBelle |
| date | April 7, 2019 |
| source | https://jonlabelle.com/snippets/view/markdown/docker-compose-cheatsheet |
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
| # All credit: http://stackoverflow.com/questions/4006324/how-to-atomically-delete-keys-matching-a-pattern-with-redis | |
| redis-cli [options] KEYS "prefix:*" | xargs redis-cli [options] DEL |
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
| #!/usr/bin/env python3 | |
| ''' | |
| @desc Simple MongoDB Client class. Offers the entire API | |
| of AsyncioMotorCollection. | |
| @author SDQ <sdq@afnor.org> | |
| @version 1.0.0 | |
| @date 2020-02-17 | |
| @note 1.0.0 (2020-02-17) : First functional version | |
| ''' | |
| from typing import Any, Optional |
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
| The MIT License (MIT) | |
| Copyright (c) 2013 Michael E. Cotterell | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
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
| plugins = {} | |
| def get_input_plugins(): | |
| return plugins['input'].items() | |
| class Plugin(object): | |
| plugin_class = None | |
| @classmethod | |
| def register(cls, name): | |
| plugins[cls.plugin_class][name] = cls |
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
| # $ pip install fdb | |
| # use this documentation for the moment http://www.firebirdsql.org/file/documentation/drivers_documentation/python/3.3.0/tutorial.html#connecting-to-a-database | |
| import fdb as kinterbasdb | |
| con = kinterbasdb.connect(dsn='/var/lib/firebird/2.5/data/rdbgraph.fdb', user='sysdba', password='masterkey') | |
| cur = con.cursor() | |
| # Execute the insert statement: | |
| name="name" |
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
| #!/bin/bash | |
| MONGO_DATABASE="your_db_name" | |
| APP_NAME="your_app_name" | |
| MONGO_HOST="127.0.0.1" | |
| MONGO_PORT="27017" | |
| TIMESTAMP=`date +%F-%H%M` | |
| MONGODUMP_PATH="/usr/bin/mongodump" | |
| BACKUPS_DIR="/home/username/backups/$APP_NAME" |
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
| sudo vi /etc/sysctl.conf | |
| # Add the following to sysctl.conf: | |
| # Decrease TIME_WAIT seconds | |
| net.ipv4.tcp_fin_timeout = 30 | |
| # Recycle and Reuse TIME_WAIT sockets faster | |
| net.ipv4.tcp_tw_recycle = 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
| # Kernel sysctl configuration file for Linux | |
| # | |
| # Version 1.12 - 2015-09-30 | |
| # Michiel Klaver - IT Professional | |
| # http://klaver.it/linux/ for the latest version - http://klaver.it/bsd/ for a BSD variant | |
| # | |
| # This file should be saved as /etc/sysctl.conf and can be activated using the command: | |
| # sysctl -e -p /etc/sysctl.conf | |
| # | |
| # For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and sysctl.conf(5) for more details. |