Skip to content

Instantly share code, notes, and snippets.

View opennomad's full-sized avatar

Matthias Johnson opennomad

View GitHub Profile
@opennomad
opennomad / tmux-vertical-toggle.sh
Created July 25, 2023 13:34
Script to toggle the vertical size of current tmux pane to maximum
#!/usr/bin/env bash
#
# author: matthias@opennomad.com
# inspiration from https://www.reddit.com/r/tmux/comments/7r8otc/is_there_short_command_to_expansetoggle_tmux_pane/
#
# This script toggles the vertical size of the current tmux pane to maximum
# Note that the other panes in the same column will still be visible, but
# they will be only one line tall.
#
# Installation:
if [[ "$(command -v peco)" ]]; then
# Search shell history with peco: https://github.com/peco/peco
# Adapted from: https://github.com/mooz/percol#zsh-history-search
function peco_select_history() {
BUFFER=$(fc -lnr 1 | peco --initial-filter Regexp --query "$LBUFFER")
CURSOR=$#BUFFER # move cursor
zle -R -c # refresh
}
zle -N peco_select_history
@opennomad
opennomad / jenkinsfile-validate.sh
Created January 11, 2021 21:19
Validate a Jenkinsfile from the command line
#!/bin/bash
# This script will send the Jenkinsfile in the current directory
# to the validation endpoint on a Jenkins server
# simply set and export the following variables, then run the script
# this will be something like "https://jenkins.yourdomain.com"
# export JENKINS_URL=''
@opennomad
opennomad / elasticbeanstalk_versions.sh
Last active June 12, 2019 14:45
version count of all Elasticbeanstalk application
# get a version count of all Elasticbeanstalk application
aws elasticbeanstalk describe-application-versions | jq '.ApplicationVersions[] | .ApplicationName' | sort | uniq -c | sort -nr
@opennomad
opennomad / log_search_strings.txt
Created March 14, 2019 19:52
Cloudwatch Log searching
# all the 4xx errors
[host, logName, user, timestamp, request, statusCode=4*, size]
@opennomad
opennomad / gist:4fcc9755b440e98e06b70a8208b01b12
Created September 18, 2018 17:16
what's my IP from the command line
dig +short myip.opendns.com @resolver1.opendns.com
@opennomad
opennomad / get_environment_settings.sh
Last active March 21, 2019 16:12
working with ElasticBeanstalk
sudo /opt/elasticbeanstalk/bin/get-config
@opennomad
opennomad / 1_find_old_snapshots
Last active March 1, 2018 14:00
Cleaning AWS snapshots older than a given date
aws ec2 describe-snapshots --owner-ids <owner> --query 'Snapshots[?StartTime<=`2017-01-01T00:00-07:00`]' > out
@opennomad
opennomad / kubernetes_dashboard_upgrade
Last active August 5, 2016 19:55
Kubernetes dashboard upgrade. The default dashboard for kubernetes 1.2 is ineffective. The following will upgrade the dashboard the running cluster.
kubectl delete svc kubernetes-dashboard --namespace kube-system
kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml
@opennomad
opennomad / github-issue-export.rb
Last active October 1, 2015 16:29
Simple way to export all issues from a github repo using token authentication
#!/usr/bin/env ruby
# Simple script to pull all issues from a github repo.
# Simply create an authentication token in github
# Then set the environment variable GITHUB_TOKEN to that
# then run the script passing the <owner>/<repo> as the one and only parameter
# output will be in JSON form. From there you can use jq - https://stedolan.github.io/jq/
# For example: cat file.json| jq '.[] | .user.login, .title, .body' etc.
# requires octokit and json module