Skip to content

Instantly share code, notes, and snippets.

View peavers's full-sized avatar
💭
I'm ready. Lets go.

Chris Turner peavers

💭
I'm ready. Lets go.
  • Seattle, Washington
View GitHub Profile
@peavers
peavers / purge.sh
Created March 24, 2021 16:45
Bulk delete workflows from GitHub Actions
# Requires GitHub CLI installed and authenticated.
export USER=""
export REPO=""
export BRANCH="master"
gh api repos/$USER/$REPO/actions/runs | jq -r '.workflow_runs[] | select(.head_branch == "master") | "\(.id)"' | xargs -n1 -I % gh api repos/$USER/$REPO/actions/runs/% -X DELETE > out.log 2> /dev/null
@peavers
peavers / spotless.xml
Created February 9, 2021 13:33
Spotless plugin
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless.version}</version>
<configuration>
<java>
<googleJavaFormat>
<version>1.3</version>
<style>AOSP</style>
</googleJavaFormat>
@peavers
peavers / gitbuildhook.xml
Created February 9, 2021 13:31
Gitbuildhook plugin
<plugin>
<groupId>com.rudikershaw.gitbuildhook</groupId>
<artifactId>git-build-hook-maven-plugin</artifactId>
<version>${gitbuildhook.version}</version>
<configuration>
<installHooks>
<pre-commit>hooks/pre-commit.sh</pre-commit>
</installHooks>
</configuration>
<executions>
@peavers
peavers / example.java
Created February 9, 2021 13:30
After Spotless
// After Spotless
public boolean eventEvicted(final SlingshotMessage message) {
return alreadyReceivedEviction(message)
|| unsubscribedEviction(message)
|| ignoreBeforeEviction(message)
|| noUndoSupportEviction(message);
}
@peavers
peavers / pre-commit.sh
Created February 9, 2021 13:28
Spotless pre-commit hook
#!/bin/sh
echo '[Git Hook] Executing Spotless check before commit'
# Only compare files that have changed compared to master
mvn spotless:check -DratchetFrom=origin/master
exit $?
@peavers
peavers / docker-compose.yml
Created August 16, 2020 10:26
docker-compose file for media server
version: "3"
services:
# https://hub.docker.com/_/traefik
traefik:
container_name: traefik
image: traefik:v2.2
restart: unless-stopped
command:
- --api
@peavers
peavers / aws-cleanup.sh
Created July 7, 2020 11:38
One liners to cleanup AWS things
#!/bin/bash
# Delete all S3 buckets matching matching the custom pattern
for bucket in $(aws s3 ls | awk '{print $3}' | grep "my-custom-pattern"); do aws s3 rb "s3://${bucket}" --force ; done
# Delete all Cloudformation stacks matching the custom pattern
for stackId in $(aws cloudformation describe-stacks --query "Stacks[?contains(StackName,'my-custom-pattern')].[StackName]" --output text); do aws cloudformation delete-stack --stack-name $stackId ; done
@peavers
peavers / .env
Created July 3, 2020 05:12
DroneCI with HTTPS
# Base domain name: example.com
DOMAIN=
# Email to register certificates for: hello@example.com
DOMAIN_EMAIL=
# GitHub username to give admin rights: peavers
GITHUB_USERNAME=
DRONE_GITHUB_CLIENT_ID=
@peavers
peavers / gist:99e57e00308982f843ddfd57b5a689b1
Created June 16, 2020 18:03
Remove all rar files recursively
find . -iname '*.r[a0-9][r0-9]' | xargs rm -f
@peavers
peavers / clean.sh
Created June 16, 2020 18:02
Delete all directories whos content is less than ~400mb
find . -mindepth 1 -maxdepth 1 -type d -exec du -ks {} + | awk '$1 <= 400000' | cut -f 2- | xargs -d \\n rm -rf