Skip to content

Instantly share code, notes, and snippets.

@craigforr
craigforr / terraform-latest.sh
Last active July 25, 2018 17:30
terraform-latest.sh - Display the download URLs for the latest version of HashiCorp Terraform
View terraform-latest.sh
#!/bin/sh
# terraform-latest.sh - Display the download URLs for the latest version of HashiCorp Terraform
CURRENT_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')
for SUFFIX in SHA256SUMS SHA256SUMS.sig darwin_amd64.zip freebsd_386.zip freebsd_amd64.zip freebsd_arm.zip linux_386.zip linux_amd64.zip linux_arm.zip openbsd_386.zip openbsd_amd64.zip solaris_amd64.zip windows_386.zip windows_amd64.zip; do
echo "https://releases.hashicorp.com/terraform/${CURRENT_VERSION}/terraform_${CURRENT_VERSION}_${SUFFIX}"
done
@craigforr
craigforr / titleUrlMarkdownClip.js
Created December 18, 2018 16:06 — forked from bradleybossard/titleUrlMarkdownClip.js
Bookmarklet to copy current page title and url in Markdown format to clipboard, like [title](url) - Usual for posting links to resources in README.md files
View titleUrlMarkdownClip.js
javascript:(function() {
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
/*IE specific code path to prevent textarea being shown while dialog is visible.*/
return clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
@craigforr
craigforr / qrcode-bookmarklet.js
Created December 19, 2018 20:29 — forked from ThomasR/qrcode-bookmarklet.js
A bookmarklet that generates a QR Code of the current URL. Click to return to page content.
View qrcode-bookmarklet.js
javascript: void (function (main) {
var script = document.createElement('script');
script.onload = main;
script.src = 'https://davidshimjs.github.io/qrcodejs/qrcode.min.js';
document.head.appendChild(script).parentNode.removeChild(script);
})(function () {
var size = 400;
var qr = new QRCode(document.body, {
text: location.href,
width: size,
@craigforr
craigforr / tmux-cheatsheet.markdown
Created April 25, 2019 21:10 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@craigforr
craigforr / profiles.json
Created August 6, 2019 20:42
Profiles for Windows Terminals (Preview, v0.3.2171.0)
View profiles.json
{
"globals" :
{
"alwaysShowTabs" : true,
"defaultProfile" : "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
{
@craigforr
craigforr / vimium-keybindings.vim
Last active August 6, 2019 20:44
Custom key mappings for the Vimium extension for Google Chrome
View vimium-keybindings.vim
map t createTab http://www.google.com
" Go one tab left (previousTab)
map K previousTab
" Go one tab right (nextTab)
map J nextTab
" Close tabs to the right (closeTabsOnLeft)
map gc closeTabsOnLeft
" Close tabs to the right (closeTabsOnRight)
map gC closeTabsOnRight
" Close all other tabs (closeOtherTabs)
@craigforr
craigforr / autopart.sh
Created October 15, 2019 15:40 — forked from trentmswanson/autopart.sh
Linux bash script to partition and format all data disks in azure
View autopart.sh
#!/bin/bash
# An set of disks to ignore from partitioning and formatting
BLACKLIST="/dev/sda|/dev/sdb"
# Base directory to hold the data* files
DATA_BASE="/media"
usage() {
echo "Usage: $(basename $0) <new disk>"
}
@craigforr
craigforr / findr.sh
Last active July 30, 2020 23:02
Finds the most recent files in the current directory tree
View findr.sh
function findr() {
# Find recently modified files in the current directory tree
SEARCH_PATH='./*'
NUMBER_OF_RESULTS=20
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help)
DISPLAY_USAGE=TRUE
shift
;;
@craigforr
craigforr / install_upgrade_kubectl.sh
Last active September 19, 2020 22:48
Installs or upgrades kubectl on Linux, including WSL2
View install_upgrade_kubectl.sh
#!/usr/bin/env bash
# Installs or upgrades kubectl on Linux
# Chuck for root privileges
if [[ "$EUID" != "0" ]] ; then
echo "Please execute script with sudo or as root."
exit 1
fi
# Check Dependencies
View tmux-default-bindings.txt
bind-key C-b send-prefix
bind-key C-o rotate-window
bind-key C-z suspend-client
bind-key Space next-layout
bind-key ! break-pane
bind-key " split-window
bind-key # list-buffers
bind-key $ command-prompt -I #S "rename-session '%%'"
bind-key % split-window -h
bind-key & confirm-before -p "kill-window #W? (y/n)" kill-window