Skip to content

Instantly share code, notes, and snippets.

View chauncey-garrett's full-sized avatar

Chauncey Garrett chauncey-garrett

View GitHub Profile
@chauncey-garrett
chauncey-garrett / vault_logrotate
Created January 31, 2020 19:18 — forked from soloradish/vault_logrotate
logrotate setting file for HashiCorp's Vault audit file
# Change the path below to your own audit log path.
/var/log/vault/audit.log {
rotate 30
daily
# Do not execute rotate if the log file is empty.
notifempty
missingok
compress
# Set compress on next rotate cycl to prevent entry loss when performing compression.
delaycompress
#!/bin/bash
OLDIFS=$IFS
export IFS=$'\n'
# Find all boxes which have updates
AVAILABLE_UPDATES=$(vagrant box outdated --global | grep outdated | tr -d "*'" | cut -d ' ' -f 2 2>/dev/null)
if [[ ${#AVAILABLE_UPDATES[@]} -ne 0 ]]; then

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@chauncey-garrett
chauncey-garrett / super-tip.txt
Created August 12, 2019 17:13 — forked from ericdouglas/super-tip.txt
Change 4 spaces to 2 spaces indentation and change tab to spaces - Vim tip
// 4 spaces to 2 spaces
%s;^\(\s\+\);\=repeat(' ', len(submatch(0))/2);g
// Tab to 2 spaces
:%s/\t/ /g
@chauncey-garrett
chauncey-garrett / TrueColour.md
Created February 13, 2018 22:27 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Colours in terminal

It's a common confusion about terminal colours... Actually we have this:

  • plain ascii
  • ansi escape codes (16 colour codes with bold/italic and background)
  • 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit)
  • 24bit true colour ("888" colours (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"
Useful One-Line Scripts for Perl Dec 03 2013 | version 1.10
-------------------------------- ----------- ------------
Compiled by Peteris Krumins (peter@catonmat.net, @pkrumins on Twitter)
http://www.catonmat.net -- good coders code, great reuse
Latest version of this file is always at:
http://www.catonmat.net/download/perl1line.txt
@chauncey-garrett
chauncey-garrett / ssh-forward-clipboard.md
Created December 22, 2017 17:25 — forked from dergachev/ssh-forward-clipboard.md
Forward your clipboard via SSH reverse tunnels

Exposing your clipboard over SSH

I frequently administer remote servers over SSH, and need to copy data to my clipboard. If the text I want to copy all fits on one screen, then I simply select it with my mouse and press CMD-C, which asks relies on m y terminal emulator (xterm2) to throw it to the clipboard.

This isn't practical for larger texts, like when I want to copy the whole contents of a file.

If I had been editing large-file.txt locally, I could easily copy its contents by using the pbcopy command:

@chauncey-garrett
chauncey-garrett / appinfo.rb
Created December 5, 2017 20:44 — forked from ttscoff/appinfo.md
A quick ruby script for Mac that returns some information for a specified Mac app in Terminal. Includes icon display if using iTerm2.
#!/usr/bin/env ruby
require 'date'
###################################################
# iii fff #
# aa aa pp pp pp pp nn nnn ff oooo #
# aa aaa ppp pp ppp pp iii nnn nn ffff oo oo #
# aa aaa pppppp pppppp iii nn nn ff oo oo #
# aaa aa pp pp iii nn nn ff oooo #
# pp pp #
###################################################
@chauncey-garrett
chauncey-garrett / prepare-commit-msg.sh
Created April 14, 2017 04:21 — forked from bartoszmajsak/prepare-commit-msg.sh
How to automatically prepend git commit with a branch name
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
@chauncey-garrett
chauncey-garrett / gist:fcb1deea4cf2db4e24596bb5dd0334f6
Created October 13, 2016 14:47
Create RSS Feed of the releases of all your starred GitHub repositories

Create RSS Feed of the releases of all your starred GitHub repositories

I have done this with Google Chrome.

  1. Get your starred repositories from the GitHub API: https://api.github.com/users/USERNAME/starred?page=1&per_page=100
  2. Open the Web developer tools in Chrome. Select the pre Tag in the HTML-View and execute this Javascript in the console: JSON.parse($0.innerText).map(function(repo) { return 'https://github.com/' + repo.full_name + '/releases.atom' }).join('\n'). This generates a list of the Release-Feed-URLs.
  3. Copy the URL list to http://reader.feedshow.com/goodies/opml/OPMLBuilder-create-opml-from-rss-list.php If you have more than 100 starred repositories, you need repeat step 1 to 3 and increment the page in the URL in step 1 each time.
  4. Click "Create OPML".
  5. Save the OPML XML file to disk.