This file contains 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
import itertools | |
import signal | |
import sys | |
import time | |
from threading import Timer | |
class Killbox: | |
def __init__(self, timeout=5): | |
self.timeout = timeout |
This file contains 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
# Pycharm Dark | |
# Theme create by: https://github.com/JakubDotPy | |
# ========= Border ========= | |
file_panel_border = "#2B2D30" | |
sidebar_border = "#CB5C27" | |
footer_border = "#2B2D30" | |
# ========= Border Active ========= | |
file_panel_border_active = "#ffc66d" |
This file contains 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
""" | |
find foo(x, y, z) == 25 | |
""" | |
import random | |
from itertools import chain | |
MAX_GENERATIONS = 10_000 | |
GEN_POOL_SIZE = 1_000 | |
BEST_N = 100 |
This file contains 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
def main(): | |
kuba = Human(name='Kuba', character='x') | |
# this does not work | |
# TypeError: Can't instantiate abstract class Player with abstract methods choose_position | |
imported_player = Player.from_file('some_player') | |
players = [kuba, imported_player] | |
board = Board(size=20, empty_character='-') |
This file contains 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
@admin.register(Role) | |
class RoleAdmin(admin.ModelAdmin): | |
filter_horizontal = [ | |
'permission_groups', | |
'permissions', | |
] | |
list_display = [ | |
'name', | |
'perm_groups_str', | |
'perm_str', |
This file contains 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
""" | |
More details on the implementation and usage can be found at | |
https://www.pyscoop.com/django-jsonfield-attributes-in-admin-filter/ | |
""" | |
from django.contrib import admin | |
from django.core.exceptions import ImproperlyConfigured | |
class JSONFieldFilter(admin.SimpleListFilter): |