Skip to content

Instantly share code, notes, and snippets.

pgib /
Created May 21, 2020
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 /
Created Nov 9, 2019
nginx startup script for Amazon Linux 2
# 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
pgib / Gemfile
Created Dec 14, 2018
Sign an S3 URL
View Gemfile
source ""
git_source(:github) {|repo_name| "{repo_name}" }
gem 'aws-sdk'
pgib / php-serialized-to-json.php
Created Jul 20, 2012
PHP serialized string to json output
View php-serialized-to-json.php
// usage: echo "some serialized string" | php php-serialized-to-json.php
while (FALSE !== ($line = fgets(STDIN))) {
echo json_encode(unserialize($line));
pgib / .tmux.conf
Last active Dec 2, 2017
Nice tmux copy and paste using OS X clipboard
View .tmux.conf
# =======================================================================
# 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
pgib /
Created May 6, 2011
My BBEdit Color Scheme
defaults write com.barebones.bbedit Color:Background -string "rgb(0,0,0)"
defaults write com.barebones.bbedit Color:CTagsIdentifier -string "rgb(57825,39937,11422)"
defaults write com.barebones.bbedit Color:ColorAttributesSeparately -string 1
defaults write com.barebones.bbedit Color:Comment -string "rgb(21845,21845,21845)"
defaults write com.barebones.bbedit Color:Comment:Ruby -string "rgb(34992,34992,34992)"
defaults write com.barebones.bbedit Color:Foreground -string "rgb(65535,65535,65535)"
defaults write com.barebones.bbedit Color:Foreground:CSS -string "rgb(56342,56342,56342)"
defaults write com.barebones.bbedit Color:GuideContrast -string 7
defaults write com.barebones.bbedit Color:HTMLAnchor -string "rgb(43690,0,0)"
defaults write com.barebones.bbedit Color:HTMLAttributeName -string "rgb(57528,45076,5799)"
pgib / ext.rb
Created Mar 11, 2014
Optional Jekyll monkey patch to use terminal-notifier to signal a Jekyll build completion. Put in _plugins/ext.rb
View ext.rb
require 'jekyll-assets'
# optional notification for jekyll build completion
# gem install terminal-notifier
# rbenv rehash
module Jekyll
class Site
pgib /
Created Oct 26, 2011
Rename all .haml to .html.haml
for h in `find . -name '*.haml'`; do
if ! echo $h | grep -q ".html.haml"; then
hh=`echo $h | sed -e s/.haml/.html.haml/`
if [ -e $hh ]; then
echo "Can't rename $h to $hh because $hh already exists. :("
View Users.csv
Joe Smith 123456 147852
Bill Jones 987654 369852
Steve Miller 654321 852147
pgib /
Last active Dec 28, 2015
Testing script to test Mac OS X Mavericks code signing for Profile Manager.

Install to /Applications/

Be sure to edit the file to set the path to your code-signing certificate.

Run with:

cd /Applications/
php -c /Applications/ signing_tester.php
You can’t perform that action at this time.