Skip to content

Instantly share code, notes, and snippets.

@TomK
TomK / .editorconfig
Last active July 11, 2024 11:50
IntelliJ `.editorconfig` file
# top-most EditorConfig file
root = true
[*.go]
ij_formatter_enabled = false
[*]
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
@TomK
TomK / busyscratch
Last active June 15, 2022 09:37
installs busybox in a scratch container if sh is not available
#!/bin/sh
TARGET=$1
if [ -z "$TARGET" ]; then
echo "no target container specified"
exit 1
fi
docker container inspect $TARGET >/dev/null
@TomK
TomK / release.yml
Last active May 14, 2021 10:04
This workflow will tag a release on github when the package.json version changes on master, and publish package to npm and github
# This workflow will tag a release on github when the package.json version changes on master, and publish package to npm and github
name: Tag Release
on:
push:
branches:
- master
jobs:
@TomK
TomK / portcheck.sh
Last active February 21, 2023 10:46
What's running on a specified port?
# What's running on a specified port?
# https://gist.github.com/TomK/b8c5bebe1e29f62d3ecff7e5223c8ff6
if [ -z "$1" ]; then
echo 'You must specify a port'
exit 1
fi
PIDS=$(lsof -nP -i:$1 |grep LISTEN |awk '{print $2}')
@TomK
TomK / nscheck.sh
Last active October 28, 2020 11:57
bash script to get records from domain authority
#!/bin/bash
# get authoritiy
AUTHORITY=$(dig +noall +trace $1 NS | grep '\tNS\t' | tail -n1 | awk '{print $5}')
echo "AUTHORITY: $AUTHORITY"
Q=$1
shift
dig @$AUTHORITY ${@:-ANY} +noall +answer $Q
@TomK
TomK / .circleci.config.yml
Last active December 7, 2021 10:20
CircleCI skeleton php config
defaults: &defaults
steps:
# common php steps
- run: echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
- run: if [ -n "$ADD_PACKAGES" ]; then apk -U add $ADD_PACKAGES; fi;
- run: if [ -n "$ADD_MODULES" ]; then docker-php-ext-install $ADD_MODULES; fi;
- run: |
if [ -n "$ADD_PECL" ]; then
docker-php-source extract \
&& apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS $ADD_PHPIZE_DEPS \
@TomK
TomK / clear-rabbit-connections.sh
Created August 31, 2017 12:36
Close all rabbit connections with state of 'closed'
#!/bin/bash
CONC=10
HOST="--host=rabbit.fortifi.uk"
echo "Listing connections..."
rabbitapi $HOST -f tsv -q list connections name state |grep closed |awk '{$NF=""; print $0}' > conn.txt
echo "Found $(wc -l conn.txt) closed connections"
I=0
@TomK
TomK / Dockerfile
Created July 12, 2017 16:17 — forked from zombiezen/Dockerfile
dep Container Builder image recipe
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@TomK
TomK / update-ssl.sh
Last active November 24, 2016 13:26
update an ssl certificate on google cloud (using a/b suffixes)
#!/bin/bash
set -e
CERT_PREFIX="$1"
CERT_PATH="$2"
CERT_KEY="$3"
if [[ $CERT_PREFIX == "" || $CERT_PATH == "" || $CERT_KEY == "" ]]; then
echo "Usage: update-ssl.sh <cert prefix> <cert path> <cert key>"