Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pgib
pgib / Dockerfile
Last active April 6, 2023 01:23
Run Jekyll in Docker
FROM ruby:3.2-bullseye AS build
WORKDIR /jekyll
RUN bundle config set --global path /vendor
RUN bundle config set --global without development
COPY Gemfile Gemfile.lock /jekyll
RUN bundle install
#!/bin/bash
# based on https://github.com/Skedulo/aws-instance-connect-proxy
set -eu
if [ $# -lt 2 ] ; then
echo "Usage: $0 [--profile profile] [--region region] [--key key] [--filter filterkey] [--value filtervalue] user host [port]"
exit
fi
rmb()
{
current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ "$current_branch" != "master" ]; then
echo "WARNING: You are on branch $current_branch, NOT master."
fi
echo "Fetching merged branches..."
git remote prune origin
remote_branches=$(git branch -r --merged | grep -v '/master$' | grep -v "/$current_branch$")
local_branches=$(git branch --merged | grep -v 'master$' | grep -v "$current_branch$")
@pgib
pgib / pre-commit
Last active August 11, 2022 23:52
CircleCI precommit hook
#!/usr/bin/env bash
# Slightly modified from: https://circleci.com/blog/circleci-hacks-validate-circleci-config-on-every-commit-with-a-git-hook/
# The following line is needed by the CircleCI Local Build Tool (due to Docker interactivity)
exec < /dev/tty
# Only validate if we've changed the .circleci/config.yml file
if git diff --cached --name-only | grep --quiet ".circleci/config.yml"; then
# Make sure we have the circleci utility installed
# https://circleci.com/docs/local-cli
@pgib
pgib / README.md
Created May 21, 2020 20:23
Clean up the bloated Backblaze bzfileids.dat

Place in /Library/Backblaze.bzpkg/bzdata/bzbackup, and run with:

ruby purge_nonexistent.rb

It will process bzfileids.dat placing any file that exists in bzfileids.dat-found and any missing file in bzfileids.dat-missing. You can then back up your original file and replace it with bzfileids.dat-found.

My original file was almost 1.4GB. It had grown so large that the backup would cause all my fans spin and it never seemed to complete. Backblaze support suggested I delete my entire backup with them and start over. After running this script, my new bzfileids.dat file is 301MB. Still huge, but about 1/5th the size. The backup seemed to go much more smoothly.

@pgib
pgib / nginx.sh
Created November 9, 2019 18:40
nginx startup script for Amazon Linux 2
#!/bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: nginx initscript
# Description: nginx
### END INIT INF
@pgib
pgib / Gemfile
Created December 14, 2018 21:14
Sign an S3 URL
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'aws-sdk'
@pgib
pgib / .zshrc
Last active August 29, 2015 14:08
My oh-my-zsh theme.
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="pgib"
# Example aliases

Keybase proof

I hereby claim:

  • I am pgib on github.
  • I am pgib (https://keybase.io/pgib) on keybase.
  • I have a public key whose fingerprint is 68AE 1949 8D8A 05E4 E9B1 4654 A811 19F0 00B6 F040

To claim this, I am signing this object:

@pgib
pgib / .tmux.conf
Last active December 2, 2017 09:54
Nice tmux copy and paste using OS X clipboard
# =======================================================================
# vim-style copy and paste
setw -g mode-keys vi
bind ] paste-buffer
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-pipe "reattach-to-user-namespace pbcopy"
bind-key -t vi-copy Space rectangle-toggle
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter