Skip to content

Instantly share code, notes, and snippets.

View jaredgrubb's full-sized avatar

Jared Grubb jaredgrubb

  • Seattle, Washington
View GitHub Profile
@jaredgrubb
jaredgrubb / string-shrink-to-fit-test.cpp
Created March 27, 2019 17:30
Test to see if shrink_to_fit actually does anything.
#include <string>
int main() {
std::string str(30, 'x');
str.resize(20);
str.shrink_to_fit();
}
@jaredgrubb
jaredgrubb / gist:7d96a1522cbdc98d80334f93912e0ad2
Created July 18, 2016 19:19
Buidbot: Get revision like Interpolate
from buildbot.process import properties
def get_revision(codebase):
@properties.renderer
def get_got_revision(props):
return props.getProperty('got_revision', {}).get(codebase)
return get_got_revision
@jaredgrubb
jaredgrubb / git-stitch
Created April 11, 2016 07:39
Git-stitch: swap two commits on a branch in cases where rebase fails miserably
#! /bin/bash
# Goal: swap two commits X and Z in a branch B.
#
# Start:
# *--*--*--Z--X--*--* B
# Goal:
# *--*--*--X--Z--*--* B
#
# Normally, git-rebase will do this easily. However if that is messy, it may be
@jaredgrubb
jaredgrubb / ManageSlavesBuilder.py
Last active August 29, 2015 14:00
Buildbot slave management via the Web UI (Buildbot 0.8.8+)
##
## "Manage Slaves" builder for buildbot:
## - a buildbot builder that can start/stop/restart any buildslave
## - runs simple shell script on slave to do the action
##
## ### INSTRUCTIONS ###
##
## On each slave, install the buildmaster's public SSH key so the buildmaster can SSH in.
## Then, add a script like the one below to each buildslave. A few notes on this script:
## - "bash -l" seems to be important in order to get the virtualenv to take correctly