Skip to content

Instantly share code, notes, and snippets.

# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@jimrazmus
jimrazmus / yubikey-colemak.sh
Created September 30, 2018 20:47
Set Yubikey scanmap to emit proper OTP with Mac OS using Colemak keyboard
#!/bin/sh
ykpersonalize -S 06050a0e08170b0f1c11180d16090c1986858a8e88978b8f9c91988d96898c99271e1f202122232425262b9e28
git remote prune origin
git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -d
git branch --merged | xargs git branch -d
@jimrazmus
jimrazmus / make-json-pretty
Last active May 4, 2018 15:08
Makefile target to beautify json files
# Makefile
json_files = $(shell find . -type f -name "*.json" | sort -u)
json-pretty:
@for f in $(json_files); do (cat "$$f" | jq -S '.' >> "$$f".sorted && mv "$$f".sorted "$$f") || exit 1 ; done
- name: parallelize ansible-playbook
hosts: localhost
gather_facts: false
tasks:
- shell: ansible-playbook {{item.yml}}
async: 3600
poll: 0
register: runner
[user]
name = Jim Razmus II
email = jim.razmus@code42.com
[push]
default = simple
[core]
excludesfile = /Users/jim.razmus/.gitignore_global
[diff]
tool = vimdiff
[difftool]
@jimrazmus
jimrazmus / yubikey-reset.sh
Created July 6, 2017 13:12 — forked from pkirkovsky/yubikey-reset.sh
Utility for resetting a Yubikey to factory defaults using gpg-connect-agent. This will wipe out any stored keys and reset PINs to default values.
gpg-connect-agent <<EOF
/hex
scd serialno
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40

An Ansible summary

Patterns

  • all (or *)
  • hostname: foo.example.com
  • groupname: webservers
  • or: webservers:dbserver
  • exclude: webserver:!phoenix
  • intersection: webservers:&amp;staging
@jimrazmus
jimrazmus / pre-commit
Created November 24, 2015 05:08 — forked from alimoeeny/pre-commit
git pre-commit hook for automatic versioning on every commit in golang
#!/bin/sh
#read more at http://alimoeenysbrain.blogspot.com/2013/10/automatic-versioning-with-git-commit.html
#replace all MYPROJECT with your project name
#for languages other than go (golang) replace all the .go extensions with your language extensions and modify BODY to reflect you language syntax
VERBASE=$(git rev-parse --verify HEAD | cut -c 1-7)
echo $VERBASE
NUMVER=$(awk '{printf("%s", $0); next}' MYPROJECTversion.go | sed 's/.*MYPROJECT\.//' | sed 's/\..*//')
echo "old version: $NUMVER"
@jimrazmus
jimrazmus / pre-commit
Created November 24, 2015 05:07 — forked from Klathmon/pre-commit
git pre-commit hook for vetting, linting, and fmt-ing go source code before commit
#! /usr/bin/env bash
# This script will automatically apply gofmt to all file in the commit
# run go tool vet and exit if there are any errors
# then run golint and display all output (commit will continue regardless of this output)
# The MIT License (MIT)
# Copyright (c) 2014 Gregory Benner <gregbenner1@gmail.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.