Skip to content

Instantly share code, notes, and snippets.

View tomcoakes's full-sized avatar

Tom Coakes tomcoakes

View GitHub Profile
@tomcoakes
tomcoakes / gist:9cfd2c8f2ab27bac2da04919b754a239
Last active March 29, 2021 11:14
display current stack in prompt but only make call when changing directory
setopt PROMPT_SUBST
pulumi()
{
if [[ "$@" == *"stack select"* ]] then
CURRENT_STACK=$(cat ~/.pulumi-prompt.json | jq '.currentStack' -r) && \
jq -n --arg currentStack $CURRENT_STACK --arg previousPwd $PWD '{"currentStack":$currentStack, "previousPwd":$previousPwd, "stackChanged": true}' > ~/.pulumi-prompt.json
fi
/opt/homebrew/bin/pulumi "$@"
}
@tomcoakes
tomcoakes / gist:9160fe578f8cd52e3da8c3988ea55ce6
Last active March 28, 2021 13:38
displaying current pulumi stack in prompt
setopt PROMPT_SUBST
up_find()
{
while [[ $PWD != / ]] ; do
find "$PWD"/ -maxdepth 1 "$@"
cd ..
done
}
@tomcoakes
tomcoakes / thing
Last active July 24, 2020 22:47
bash - backgrounding and directing logs in one command
npm start > server.log 2>&1 &
@tomcoakes
tomcoakes / fullAggQuery.json
Last active February 12, 2020 11:44
Full aggregation query for deal count/averages/median summaries
{
"aggs": {
"valueIsDisclosed": {
"terms": {
"field": "computed.valueIsDisclosed"
}
},
"fitsMMCriteria": {
"terms": {
"field": "_computed.fitsMMCriteria"
{
"editions": {
"type": "checkbox",
"filters": [
{
"disabled": false,
"name": "North America",
"mmgid": "na",
"type": "editions",
"count": 1323
atom-sync-settings-gist
@tomcoakes
tomcoakes / gist:18142d5bbf39c70f735c
Created June 25, 2015 11:24
Cloning down remote branches to new local branches
git fetch <remote> <rbranch>:<lbranch>
git checkout <lbranch>