Skip to content

Instantly share code, notes, and snippets.

View tombruijn's full-sized avatar

Tom de Bruijn tombruijn

View GitHub Profile
@tombruijn
tombruijn / README.md
Last active January 16, 2024 16:14
Retry until fail script

Until fail

Retry a command until it fails.

Debugging brittle specs is annoying and time consuming work. Let's automate finding those brittle specs by retrying them until they fail.

Accompanying blog post.

Usage

@jdforsythe
jdforsythe / oldest-ancestor-alias.sh
Created August 2, 2016 12:29
GIT find commit where branched off
#!/bin/bash
# "master" is the name of your main branch you'll be comparing to, or you can pass the "parent" branch as an argument
# it compares against the current branch by default, but you can pass a second argument to specify a child branch
# this creates a permanent alias so you can use `git oldest-ancestor` to get the oldest ancestor of the current branch at any time
git config --global alias.oldest-ancestor '!zsh -c '\''diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "${1:-master}") <(git rev-list --first-parent "${2:-HEAD}") | head -1'\'' -'
@bmhatfield
bmhatfield / .profile
Last active May 6, 2024 22:27
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@luan
luan / shell-colors-vim-hybrid.sh
Last active May 26, 2016 12:13
Non-intrusive setting for shell colors that works with vim-hybrid out of the box.
#!/bin/sh
# Shell colors for vim-hybrid - Shell color setup script
# Luan Santos (http://luansantos.com)
if [ "${TERM%%-*}" = 'linux' ]; then
# This script doesn't support linux console (use 'vconsole' template instead)
return 2>/dev/null || exit 0
fi
color017="00/00/5f"
@ArtemGr
ArtemGr / system.rs
Last active December 22, 2023 07:08
Read lines from a pipe as soon as they come out (useful for filtering).
#![feature(mpsc_select, box_syntax)]
use std::io;
use std::process::Command;
use std::sync::mpsc::{channel, Receiver, Select};
use std::string::FromUtf8Error;
use std::thread::spawn;
#[derive(Debug)]
enum PipeError {
@basti
basti / application.rb
Last active March 1, 2021 10:42 — forked from keighl/application.rb
Local Rails 4 assets precompilation using Capistrano 3 and rsync
# Speed things up by not loading Rails env
config.assets.initialize_on_precompile = false
@mrrooijen
mrrooijen / hdiutil.sh
Last active January 2, 2016 22:59
Set of commands for creating OSX Journaled (Extended) Encrypted images. Attaching them. Detaching them. Attaching them on system boot.
# Create a 10 megabytes, blank, AES 256 Encrypted, with password "mypassword",
# MacOS Journaled (Extended) image named "MyImage" when attached,
# and myimage.dmg as filename in the current directory.
#
echo -n "mypassword" | hdiutil create \
-encryption AES-256 \
-stdinpass \
-size 10m \
-fs "Journaled HFS+" \
-volname MyImage \
@thoop
thoop / nginx.conf
Last active December 8, 2023 21:55
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@pcreux
pcreux / Gemfile
Last active December 11, 2023 20:24
Fast Rails + Heroku Configuration
group :production do
gem 'unicorn'
# Enable gzip compression on heroku, but don't compress images.
gem 'heroku-deflater'
# Heroku injects it if it's not in there already
gem 'rails_12factor'
end
@eprothro
eprothro / Compass Retina Spriting.md
Last active December 27, 2015 10:09
Sass sprite generation with compass for retina and non-retina images (example code for a Rails 3 application).

Overview

The below Sass+Compass/Ruby can be used to:

  • Generate retina and non-retina sprite maps
  • Allow a single style class to provide retina and non-retina support, per image
  • Automatically generate those sprite style classes

Example markup for a retina supported menu button:

%a.icon-hamburger