#!/bin/bash | |
# 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 | |
fi |
#!/usr/bin/python | |
from __future__ import print_function | |
import requests | |
import json | |
import argparse | |
try: | |
from Queue import Queue | |
except: |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
''' | |
usage: | |
cat about.txt | python soinput.py | |
''' | |
import sys |
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.
main(argc, argv) | |
int argc; | |
char *argv[]; | |
{ | |
int i; | |
argc--; | |
for(i=1; i<=argc; i++) | |
printf("%s%c", argv[i], i==argc? '\n': ' '); | |
} |
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.
#!/usr/bin/awk -f | |
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff | |
# 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 |