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 Google Sheets script keeps data in the specified column sorted any time | |
* the data changes. | |
* | |
* After much research, there wasn't an easy way to automatically keep a column | |
* sorted in Google Sheets, and creating a second sheet to act as a "view" to | |
* my primary one in order to achieve that was not an option. Instead, I | |
* created a script that watches for when a cell is edited and triggers | |
* an auto sort. | |
* |
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 | |
import matplotlib | |
import matplotlib.pyplot as plt | |
import random | |
class Individual(object): | |
def __init__(self, numbers=None, mutate_prob=0.01): | |
if numbers is None: | |
self.numbers = np.random.randint(101, size=10) |
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
# put this into your ~/.bashrc file | |
# or ~/.bash_functions file | |
# | |
# # ex - archive extractor | |
# # usage: ex <file> | |
ex () { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xjf $1 ;; | |
*.tar.gz) tar xzf $1 ;; |
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 PIL import Image, ImageDraw, ImageFont | |
from textwrap import wrap | |
def get_y_and_heights(text_wrapped, dimensions, margin, font): | |
"""Get the first vertical coordinate at which to draw text and the height of each line of text""" | |
# https://stackoverflow.com/a/46220683/9263761 | |
ascent, descent = font.getmetrics() | |
# Calculate the height needed to draw each line of text (including its bottom margin) | |
line_heights = [ |