Follow this guide to install WSL:
https://docs.microsoft.com/en-us/windows/wsl/install-win10
- Get your build tools and python required libraries installed:
{ | |
"raw_command": "from django.db import connection;c = connection.cursor();table = 'TABLENAME';sql = f'TRUNCATE TABLE {table} CASCADE';c.execute(sql)" | |
} |
Follow this guide to install WSL:
https://docs.microsoft.com/en-us/windows/wsl/install-win10
class ArrayFieldCheckboxSelectMultiple(CheckboxSelectMultiple): | |
"""A CheckboxSelectMultiple widget for use with ArrayField which fixes the Multiple items not selected issue""" | |
def format_value(self, value): | |
"""Return selected values as a list.""" | |
if value is None and self.allow_multiple_selected: | |
return [] | |
elif self.allow_multiple_selected: | |
value = [v for v in value.split(",")] |
def create_drop_tables_raw_command(tables: list[str]) -> str: | |
"""Get list of tables using the 'manage sqlflush' command. This will create the DROP TABLE command for resetting the database""" | |
django_migrations_table = "django_migrations" | |
if django_migrations_table not in tables: | |
print(f"-- '{django_migrations_table}' not given, adding to tables!") | |
tables.append(django_migrations_table) | |
statements = ["from django.db import connection"] | |
statements.append("cursor = connection.cursor()") |
# docker build -t ubuntu1604py36 | |
FROM ubuntu:16.04 | |
RUN apt-get update && \ | |
apt-get install -y software-properties-common && \ | |
add-apt-repository ppa:jonathonf/python-3.6 | |
RUN apt-get update | |
RUN apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv | |
RUN apt-get install -y git |
def valid_date_type(arg_date_str): | |
"""custom argparse *date* type for user dates values given from the command line""" | |
try: | |
return datetime.datetime.strptime(arg_date_str, "%Y-%m-%d") | |
except ValueError: | |
msg = "Given Date ({0}) not valid! Expected format, YYYY-MM-DD!".format(arg_date_str) | |
raise argparse.ArgumentTypeError(msg) | |
def valid_datetime_type(arg_datetime_str): | |
"""custom argparse type for user datetime values given from the command line""" |
# referecing: # https://www.digitalocean.com/community/tutorials/how-to-install-apache-kafka-on-ubuntu-14-04 # https://chongyaorobin.wordpress.com/2015/07/08/step-by-step-of-install-apache-kafka-on-ubuntu-standalone-mode/
$ sudo useradd kafka -m
Assumes you already have a sphinx project installed and a project created
make html
By default this command will build documentation to
_build/html
""" | |
Script to replace color #RRGGBB formated values to grayscale values inplace. | |
usage: | |
python hexcolor2grayscale.py filename1 filename2 | |
""" | |
import fileinput | |
import sys | |
import re | |
import colorsys |