Skip to content

Instantly share code, notes, and snippets.

building and learning

Michael michaelcoyote

building and learning
  • The Bay Area, NorCal, Earth
View GitHub Profile
View plot.awk
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device.
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average

Bash key combinations and shortcuts

The bash shell uses a library called GNU Readline that provides easy and quick CLI key combination access to bash history, screen movement and line editing commands. I've collected some of these here along with some builtin bash shortcuts for history and other functions.

Note: The command bind -p will list all the keybindings and the readline functions they call.

woodsaj /
Last active Dec 17, 2019
Walk graphite metrics tree from specified prefix
from __future__ import print_function
import requests
import json
import argparse
from Queue import Queue
othiym23 /
Last active Sep 10, 2017
An experiment. Subject to change.
mroth /
Last active Jan 25, 2017
Adds the currently playing iTunes track to your prepared git commit message.
# Adds the currently playing iTunes track to your prepared commit message.
# To install, save in repo as chmod +x to .git/hooks/prepare-commit-msg
SONG=`osascript -e 'tell application "iTunes" to if player state is playing then "♬ : " & artist of current track & " / " & name of current track'`
if [[ $SONG ]]; then
echo -e "$(cat $1)\n\n$SONG" > $1
tristanfisher / Ansible-Vault
Last active Apr 22, 2021
A short tutorial on how to use Vault in your Ansible workflow. Ansible-vault allows you to more safely store sensitive information in a source code repository or on disk.
View Ansible-Vault

Working with ansible-vault

I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.

What I decided on was the following: put your secret information into a vars file, reference that vars file from your task, and encrypt the whole vars file using ansible-vault encrypt.

Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.

joshbirk /
Last active Oct 6, 2019
Another simple Python example with a real OAuth flow. This uses responses and the simple-salesforce lib
import cgi
import requests
import json
from simple_salesforce import Salesforce
#login here:
fyears /
Created Nov 28, 2012
python stdin example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
cat about.txt | python
import sys
fogus / 0 - UNIX Fifth Edition
Created Jul 20, 2011
UNIX V5, OpenBSD, Plan 9, FreeBSD, and GNU coreutils implementations of echo.c
View 0 - UNIX Fifth Edition
main(argc, argv)
int argc;
char *argv[];
int i;
for(i=1; i<=argc; i++)
printf("%s%c", argv[i], i==argc? '\n': ' ');