Skip to content

Instantly share code, notes, and snippets.

# on MacOS to avoid the "zsh: no matches found" error, wrap url in quotes, or 'setopt noglob' to
# turn off wildcard '?' matching
# show HTTP response
curl -i url
# follow 302 redirects
curl -L url
# search response for http status, discarding all other content, and following redirects (-L)
@kevinhooke
kevinhooke / gist:5e03ce43f1f004a37a4f5a3a6763e841
Created November 25, 2025 09:42
Django view template notes
{% expression %}
{{ output_value_in_context }}
{% for item in items %}
{{ item }}
{% endfor %}
{% if item %}
output something
Running dev server:
python3 manage.py runserver
Adding a user to admin:
python3 manage.py createsuperuser
Adding app to installed apps:
In yoursite/settings.py, add to:
INSTALLED_APPS = [
]
@kevinhooke
kevinhooke / gist:2b2cd53724b5ebc0fe6778c51d4df1c0
Created September 4, 2025 09:00
JUnit run specific test in a Maven submodule
mvn test -Dtest=package.testname -pl subprojectname -am -Dsurefire.failIfNoSpecifiedTests=false
// -pl module name containing test
// -am = also modules, to build dependent modules
// -Dsurefire.failIfNoSpecifiedTests=false = don't fail if dependent modules don't contain any tests
SELECT version FROM PRODUCT_COMPONENT_VERSION
WHERE product LIKE 'Oracle Database%';
@kevinhooke
kevinhooke / gist:0cbcd835699b1308ff40fe66e108a114
Created July 10, 2025 08:22
bash command line navigation shortcuts
Ctrl-a : jump to start of line
Ctrl-e : jump to end of line
@kevinhooke
kevinhooke / gist:d65deb6c6f212b70826d34b8d83552ef
Created June 24, 2025 12:45
git: Show diff for staged changes
If you've already staged changes ready to commit but want to view the diff, use:
git diff --cached
@kevinhooke
kevinhooke / gist:e20d29015932e7d481055c49bb09ac36
Last active June 24, 2025 12:37
Reviewing git stash changes without applying, and selective checkout from stash
To review changes stashed (git stash push) without retrieving from stash:
What files have changed:
- git stash show
View diffs on stashed changes (patch):
- git stash show -p
To checkout a single file from the latest {0} stash (change number to reference other stashes if not latest)
\dt # describe all tables
\d tablename # describe table tablename
@kevinhooke
kevinhooke / gist:9726a97ff69d7eca8ddb428896fb559d
Created May 30, 2025 10:27
Terraform local provider local_file using a template
terraform {
required_providers {
local = {
source = "hashicorp/local"
}
}
# Provider functions require Terraform 1.8 and later.
required_version = ">= 1.8.0"
}