Skip to content

Instantly share code, notes, and snippets.

@kevinhooke
kevinhooke / gist:ee0b9ecf52a260c12a4c2127e30e1413
Last active July 10, 2026 15:16
Git alias for ai assisted commits
git config --global alias.agent-commit "commit --trailer 'Co-authored-by: Claude Sonnet 4.6 noreply@anthropic.com'"
git config --global alias.agent-commit "commit --trailer 'Co-authored-by: Claude Opus 4.8 noreply@anthropic.com'"
project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
@kevinhooke
kevinhooke / gist:84ffd6ddf5d14379efb00b4e490460e7
Created April 14, 2026 09:39
find using regex instead of -name, e.g. for *Test.java files in maven path structure
find . -regex ".*/src/test/.*Test.java"
@kevinhooke
kevinhooke / gist:a718c5bdac7513ff478f4963eeb742c4
Created February 12, 2026 10:59
Docker cleanup commands
# delete compose stack PLUS attached volumes
docker compose down -v
# delete dangling containers / images
docker image prune
docker container prune
@kevinhooke
kevinhooke / gist:e940f67969a705da5531095f5953306a
Created December 19, 2025 16:59
Run ansible where sudo requires password
ansible-playbook -i inventory.yml playbook.yml --ask-become-pass
# 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
Last active March 3, 2026 09:53
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
# interactive shell for Django apps
python3 manage.py shell
# Adding app 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%';