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
import random | |
from collections import Counter | |
simulations = 1000000 | |
def dice_roll(): | |
return random.randint(1, 20) | |
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
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "r", function() | |
local current_focus = hs.application.frontmostApplication(); | |
hs.application.launchOrFocus('Google Chrome'); | |
local browser = hs.appfinder.appFromName('Google Chrome') | |
hs.timer.doAfter(.5, function() | |
hs.eventtap.keyStroke({"cmd"}, "r", 1000, browser); |
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
F2:: | |
; Save current window | |
WinActivate,ahk_class Chrome_WidgetWin_1 | |
; --------------------------------------- | |
; Refresh Chrome | |
Process, Exist, chrome.exe | |
If(ErrorLevel) { | |
WinActivate, ahk_pid %ErrorLevel% |
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
@deconstructible | |
class PlainASCIIUsernameValidator(validators.RegexValidator): | |
regex = good_username_regex | |
message = _( | |
'Enter a valid username. This value may contain only English letters and numbers' | |
) | |
flags = re.ASCII | |
def random_username(): | |
return uuid.uuid4().hex[:username_max_length] |
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
import tempfile | |
import webbrowser | |
import time | |
def tobrowser(response): | |
html_txt = response.content.decode("utf-8") | |
tmp = tempfile.NamedTemporaryFile(delete=False) | |
path = tmp.name + '.html' | |
f = open(path, 'w') |
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
from datetime import datetime | |
from django.utils.timezone import make_aware | |
from django.forms import TextInput, MultiWidget, DateTimeField | |
# nightmare discussion here https://stackoverflow.com/questions/38601/using-django-time-date-widgets-in-custom-form | |
class MinimalSplitDateTimeMultiWidget(MultiWidget): | |
def __init__(self, widgets=None, attrs=None): | |
if widgets is None: |
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
{% if is_paginated %} | |
<div class="col-12 text-center mx-auto "> | |
<div class="btn-group text-center" role="group"> | |
<a class='btn btn-secondary' | |
{% if page_obj.has_previous %}href="?page={{ page_obj.previous_page_number }}" | |
{% else %} disabled | |
{% endif %}> | |
<i class="fal fa-angle-double-left"></i> | |
</a> |
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
# USAGE | |
# python multi_object_tracking_fast.py --prototxt mobilenet_ssd/MobileNetSSD_deploy.prototxt --model mobilenet_ssd/MobileNetSSD_deploy.caffemodel --video race.mp4 | |
# import the necessary packages | |
from imutils.video import FPS | |
import multiprocessing | |
import numpy as np | |
import argparse | |
import imutils | |
import dlib |
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
# MIT License | |
# | |
# Copyright (c) 2019 Andy Thomas Woods | |
# | |
# 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
// instantiating the expansion panel with the below. Note the 500ms delay then adding another item. | |
// body: (){ | |
// List<MinimalModel> items = [MinimalModel(),MinimalModel()]; | |
// | |
// Timer(Duration(milliseconds: 500), (){ | |
// items.add(MinimalModel()); //should be wrapped with setState | |
// }); | |
// | |
// return ExpansionPanelIssue(items); | |
// }() |
NewerOlder