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 logging | |
from logging.handlers import RotatingFileHandler | |
def setup_logger(): | |
MAX_BYTES = 10000000 # Maximum size for a log file | |
BACKUP_COUNT = 9 # Maximum number of old log files | |
# The name should be unique, so you can get in in other places | |
# by calling `logger = logging.getLogger('com.dvnguyen.logger.example') | |
logger = logging.getLogger('com.dvnguyen.logger.example') |
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
@ECHO OFF | |
SETLOCAL EnableDelayedExpansion | |
REM Insert your conda env here | |
SET CONDA_ENV=MY_DESIRED_CONDA_ENV | |
CALL :activate_conda_env | |
REM Insert your python script here |
First, in an administrator command prompt, enable unrestricted Powershell script execution (see About Execution Policies):
set-executionpolicy unrestricted
Then makes sure that the conda Script directory in is your Path.
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
from tkinter import * | |
from tkinter.colorchooser import askcolor | |
class Paint(object): | |
DEFAULT_PEN_SIZE = 5.0 | |
DEFAULT_COLOR = 'black' | |
def __init__(self): |
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
"""making a dataframe""" | |
df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB')) | |
"""quick way to create an interesting data frame to try things out""" | |
df = pd.DataFrame(np.random.randn(5, 4), columns=['a', 'b', 'c', 'd']) | |
"""convert a dictionary into a DataFrame""" | |
"""make the keys into columns""" | |
df = pd.DataFrame(dic, index=[0]) |
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
:: This batch file converts HTML files in a folder to docx. | |
:: It requires Pandoc, and a list of files to convert | |
:: named file-list, in which each file is on a separate line, | |
:: and contains no spaces in the filename. | |
:: | |
:: Don't show these commands to the user | |
@ECHO off | |
:: Set the title of the window | |
TITLE Convert html to docx | |
:: This thing that's necessary. |
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
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
packed_extension_path = '/path/to/packed/extension.crx' | |
options = Options() | |
options.add_extension(packed_extension_path) | |
driver = webdriver.Chrome(options=options) |
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
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | |
' Hit Ctrl+F and find the second instance of "here" | |
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | |
exetxt = "" | |
loc = 0 | |
eax="eax":ecx="ecx":edx="edx":ebx="ebx":esp="esp":ebp="ebp":esi="esi":edi="edi" | |
cs="cs":ds="ds" | |
al="al":cl="cl":dl="dl":bl="bl" | |
ah="ah":ch="ch":dh="dh":bh="bh" | |
ax="ax":cx="cx":dx="dx":bx="bx":sp="sp":bp="bp":si="si":di="di" |
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 numpy as np | |
screen_size = 40 | |
theta_spacing = 0.07 | |
phi_spacing = 0.02 | |
illumination = np.fromiter(".,-~:;=!*#$@", dtype="<U1") | |
A = 1 | |
B = 1 | |
R1 = 1 |
NewerOlder