Skip to content

Instantly share code, notes, and snippets.

@jecolasurdo
jecolasurdo / INSTRUCTIONS.md
Last active April 9, 2026 01:38
Neovim config: live markdown preview with auto-prompt on file open

Neovim Live Markdown Preview

Whenever you open a .md file, Neovim will prompt you to open a live preview in your browser. The preview syncs to your buffer as you type.

Requirements

  • Neovim 0.12+
  • Git
  • Node.js
## This help screen
help:
printf "Available targets\n\n"
awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf "%-15s %s\n", helpCommand, helpMessage; \
} \
@jecolasurdo
jecolasurdo / promptoptions.go
Created December 4, 2021 05:27
A function for CLI prompt options
package clistuff
import (
"bufio"
"fmt"
"net/url"
"os"
"strings"
)
@jecolasurdo
jecolasurdo / git-bump
Created September 19, 2021 03:06
git command for incrementing semver tags
#!/usr/local/bin/python3
import operator
import re
import subprocess
import sys
# Slightly modified from the semver.org spec (see note below).
# https://regex101.com/r/Ly7O1x/3/
@jecolasurdo
jecolasurdo / download_all_scripts.py
Last active May 2, 2021 07:05 — forked from nchibana/download_all_scripts.py
Scrape IMSDB movie scripts
import os
import requests
import random
from datetime import datetime
from urllib.parse import quote
from bs4 import BeautifulSoup
BASE_URL = 'http://www.imsdb.com'
@jecolasurdo
jecolasurdo / README.md
Last active June 18, 2021 18:17
Rotate your aws access keys.

Utility for rotating those pesky AWS access keys

Important: Only supports the default profile! If you have more than one profile setup via aws configure, this script is only capable of targetting the default profile. Other profiles are ignored.

To install and run:

  1. Copy the contents of install-and-run.sh to your terminal and press enter.
  2. Bash will download, install, and start the script.
  3. The script will prompt you for your AWS username (i.e. "Joe")
@jecolasurdo
jecolasurdo / pair.go
Created September 15, 2018 00:34
pairing function
func pairingForInts(k ...int64) int64 {
if len(k) == 0 {
return -1
}
if len(k) == 1 {
return k[0]
}
var p float64
#!/bin/bash
filter="$1"
if [ -z "$filter" ]; then
echo "Please supply a filter value."
exit 1
fi
groupNames=$(aws logs describe-log-groups \
@jecolasurdo
jecolasurdo / handy ccv2 stuff
Last active June 11, 2018 05:23
Handy snippets to use when working with ccv2
# remove all files below a generated directory except .gitkeep
find . -type f -regex .*generated/.* -not -regex .*\.gitkeep -delete
# run all unit tests excluding integration tests and only show failures
go test -count=1 -race $(go list ./... | grep integrationtest -v) 2>/dev/null | grep FAIL
# run all unit tests with coverage and list them from highest coverage to lowest
for p in $(go list ./... | grep integrationtest -v); do go test -count=1 -cover -race $p; done | grep \? -v | sort -k 4
# list log group ARNs for CCV2
@jecolasurdo
jecolasurdo / must.go
Last active April 4, 2018 21:51
Must. A 30 minute rabbit hole of interesting non-performant and opaque code.
// Must executes the supplied function and panics if the function returns an error.
//
// In practice, this approach to forcing a panic should be avoided because it's non-performant,
// and does nothing to increase code clarity. But it was a fun little rabbit hole to wander down.
// It's also a nice little example of how to call a function via reflection.
//
// supported type for f is
// func(T) error
// where `T` is the underlaying type for `input`
//