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
"""Override of Django's squashmigrations management command to allow improved optimization (with increased risk!!!) | |
# Source | |
Copied from the squashmigrations management command in Django 4.2.x: | |
https://github.com/django/django/blob/c5d196a6/django/core/management/commands/squashmigrations.py | |
# Use | |
The `--force-defer` option triggers the new behavior: | |
`python manage.py mysquashmigrations --force-defer` |
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
"""Advent of Code 2022: Day 1""" | |
def get_input(path): | |
with open(path) as i: | |
return i.read() | |
def get_input_lines(path): | |
i = get_input(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
#!/usr/bin/bash | |
################################################################################ | |
# | |
# Description: | |
# Convert images for compatibility with the Supernote A6X and A5X. | |
# | |
# If an original image's size exceeds the ratio required to be compatible | |
# with the Supernote, it will automatically be centered and cropped. | |
# | |
# Usage: |
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
#!/bin/bash | |
#description : Set MFA session in environment variables | |
#usage : source mfa-env [token-from-mfa-device] | |
#requirements : Install aws-cli v2 | |
mfa_config=~/.aws/mfa | |
mfa_device_arn="" | |
mfa_token="${1-}" | |
if [ ! -f $mfa_config ]; then |
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
#!/bin/bash | |
#description :This script will make a header for a bash script. | |
#usage :tf plan -exclude=route53 -exclude=s3 | |
#requirements :Install Terraform | |
get_local_state() { | |
# List all Terraform resource, data, and module objects in a directory. | |
# Note: This ignores 'module' objects! | |
state="$(grep -rho --include="*.tf" -E "^(resource|data).*\"" .)" |
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 wrap_log_output(message: str, line_char: str = "#", log: logger = logger.info): | |
if not isatty(sys.stdin.fileno()): | |
log(message) | |
else: | |
_, columns = subprocess.check_output(["stty", "size"]).split() | |
def hr(): | |
print(line_char * int(columns)) | |
hr() |
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
class ProgressBar: | |
def __init__(self, total_items=None, title="Progress", bar_length=60): | |
self.title = title | |
self.bar_length = bar_length | |
self.total_items = total_items | |
self.start_time = timer() | |
self.is_tty = isatty(sys.stdin.fileno()) | |
def get_time_elapsed(self): | |
elapsed = timer() - self.start_time |
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 print_runtime(func): | |
""" | |
Decorator to log the name and runtime in seconds for a callable. | |
:param func: | |
:return: | |
""" | |
def wrapper(*args, **kwargs): | |
start = timer() |
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
<!doctype html> | |
<html class="no-js" lang=""> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<title>Direct Employers Tests - Tim Loyer</title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
</head> |
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
<?php namespace Acme\V1\Handlers; | |
use Acme\V1\Eventing\EventListener; | |
use Acme\V1\Eventing\Events\AssetHasBeenUploaded; | |
use Acme\V1\Eventing\Events\ProductionHasBeenUploaded; | |
use Illuminate\Queue\QueueInterface as Queue; | |
class EncodeListener extends EventListener { | |
protected $queue; |
NewerOlder