Skip to content

Instantly share code, notes, and snippets.

View rbtr's full-sized avatar
🛰️
heat on high until hot

Evan Baker rbtr

🛰️
heat on high until hot
View GitHub Profile
@rbtr
rbtr / heap.go
Created April 4, 2020 22:51
go string heap example
package main
import (
"fmt"
"container/heap"
)
type StringHeap []string
func (h StringHeap) Len() int { return len(h) }

Keybase proof

I hereby claim:

  • I am rbtr on github.
  • I am evanbaker (https://keybase.io/evanbaker) on keybase.
  • I have a public key ASBVYGVMRCqF6t6z5xrcxDiYu_vPj-Ct749lCUkpE3yuzwo

To claim this, I am signing this object:

@rbtr
rbtr / kubectl get nodes --by-age
Created August 27, 2018 16:10
sort kubernetes nodes by age
kubectl get nodes --sort-by=".status.conditions[?(@.reason == 'KubeletReady' )].lastTransitionTime"
@rbtr
rbtr / docker-compose.sh
Created September 2, 2017 00:04
"docker-compose"-in-container magic
#!/bin/sh
#
# Run docker-compose in a container
#
# This script will attempt to mirror the host paths by using volumes for the
# following paths:
# * $(pwd)
# * $(dirname $COMPOSE_FILE) if it's set
# * $HOME if it's set
#
@rbtr
rbtr / git_rn.sh
Created October 26, 2016 14:02
Script to fix wrong git committer email/username by rewriting history
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@rbtr
rbtr / AgeOfEarth.m
Created January 29, 2016 04:47
Radiant cooling approach to calculate the age of the Earth
function [age,ri,sio,sii,vi,dr,A,T,checkIndex,egen] = ageOfEarth(n,dt)
clc
format compact
fprintf('Running ageOfEarth with parameters %i cells and a time step of %i\n',n,dt);
% This function will use an implicit time differencing scheme to solve for
% the age of the earth given some stated initial and boundary conditions
% Passed Variables
@rbtr
rbtr / AsmResize.vba
Created January 20, 2016 15:23
Parametric resizing of assembly components (Inventor)
' This Sub must be in Module1 of the Assembly DocumentProject for the PartsRunner to find it
Sub SubPartsRunner(part As PartDocument, parent As AssemblyDocument)
Dim parentWidth As String
Dim parentHeight As String
parentWidth = "WIDTH"
parentHeight = "HEIGHT"
Dim userParams As UserParameters
Set userParams = part.ComponentDefinition.Parameters.UserParameters
@rbtr
rbtr / ssh-copy-id.sh
Last active July 16, 2016 21:52
Port of ssh-copy-id for Mac OS
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
#
# To download and run in one step, copy and paste this in to your terminal,
# replacing "<thisURL>" with this address and "<remote>" with the name of your endpoint:
# sh -c "$(wget -O - <thisURL>)" <remote>
@rbtr
rbtr / BATCH_RENUMBER.bat
Created July 8, 2015 19:38
Windows Batch File Renumbering
rem BATCH_RENUMBER.bat
rem v1
rem 8 July 2015
rem EAB @ NHF
@echo off
setlocal EnableDelayedExpansion
cls
@rbtr
rbtr / AccentColorStateList.java
Last active August 29, 2015 14:23
Accent ColorStateList generator
/*
* The new Design Support Library NavigationView generates a ColorStateList that tints the
* selected item with the theme Primary Color
* This method generates a ColorStateList the same way but with the theme Accent Color
* instead.
*/
/**
* Util method that builds a themed Color State List with the theme Accent Color as the selected
* tint (instead of the Primary Color that NavigationView uses by default)