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
#!/bin/bash | |
set -eou pipefail | |
# Function to display usage instructions | |
display_usage() { | |
echo "This script uses SQLite3 to load a CSV file into memory and then query it with SQL, printing the results to stdout." | |
echo "The table name will be 'csv', so use that in your queries." | |
echo "" | |
echo "Usage: $0 -f|--file <file_path> [-q|--query <query>] [-p|--print-header] [-h|--header-fix]" |
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
#!/bin/bash | |
# Place this script in your path and make it executable | |
# Display the script's usage | |
display_usage() { | |
echo "Git Checkout Default Script" | |
echo "This git script will check out the default HEAD branch" | |
echo "and pull the latest from the remote. Optionally it will" | |
echo "create a new branch ready for you to work on." |
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
#!/bin/bash | |
# A script to search for all terraform files in a directory and replace | |
# the source attribute of any module references with a specific git ref tag/commit. | |
# This is useful for pinning a specific version of a module in a terraform project. | |
# | |
# Note: | |
# this script was tested on MacOS and may need to be modified for other platforms | |
# as the sed command may differ. | |
# |
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
### My current .envrc defaults for defaults for a python project | |
# I use asdf to manage runtimes. | |
# Using asdf with direnv like this removes the | |
# annoying shims, which for me is more reliable | |
# less confusing and slightly faster | |
use asdf | |
unset PYTHONHOME |
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
#!/usr/bin/env bash | |
# | |
# For use on systems where you might want a global alias to `docker compose`. | |
# | |
# If you just need an alias for your own user a shell alias in your profile probably makes more sense. | |
# | |
# If you need compatability with the docker-compose v1 container naming convention | |
# (with underscore delimiter _ over -), you can add the --compatability flag to the below commands. | |
# |
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 typing import Optional | |
from typing_extensions import Self | |
class Node: | |
def __init__(self, value: Optional[any] = None): | |
self.prev: Optional[Self] = None | |
self.next: Optional[Self] = None | |
self.value: any = value |
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 you want to export a .env file | |
# with a list of key values like | |
# | |
# `FOO=BAR` | |
# | |
# without prefixing them with `export` e.g. | |
# | |
# `export FOO=BAR` | |
# | |
# Do the following: |
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 astroid.nodes import Call, ClassDef, FunctionDef, Name, node_classes | |
from pylint.checkers import BaseChecker | |
from pylint.interfaces import IAstroidChecker | |
def register(linter) -> None: | |
linter.register_checker(DeprecatedChecker(linter)) | |
class DeprecatedChecker(BaseChecker): |
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
#!/bin/bash | |
# | |
# .git/hooks/commit-msg is run when the -m flag is used | |
# | |
# Will extract Jira style ticket numbers from branch names e.g. | |
# 'AB-123-my-cool-branch' --> '[AB-123]' | |
# 'feature/XZ-321-my-cool-branch' --> '[XZ-321]' | |
# | |
TICKET=[$(git rev-parse --abbrev-ref HEAD | grep -Eo '^(\w+/)?(\w+[-_])?[0-9]+' | grep -Eo '(\w+[-])?[0-9]+' | tr "[:lower:]" "[:upper:]")] | |
if [[ $TICKET == "[]";then |
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
<# | |
.SYNOPSIS | |
This Powershell script updates the security descriptor for scheduled tasks so that any user can run the task. | |
Version 1.0 of this script only displays tasks in the root folder. I want to make sure that works first. | |
.DESCRIPTION | |
Earlier versions of Windows apparently used file permissions on C:\Windows\System32\Tasks files to manage security. | |
Windows now uses the SD value on tasks under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree to accomplish that. |