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 / Count to 10 Game
Last active August 29, 2015 14:18
MATLAB code for a 2 player count to 10 game.
clc
sum = 0;
player = 1;
while (sum < 10)
choice = -1;
fprintf('Player %i\n', player);
@rbtr
rbtr / ScreenSizeUtils.java
Created April 14, 2015 02:42
A Screen Size Utility Class for Android
/**
* This class is just a helper package to get the screen dimensions
*/
public class ScreenSizeUtils {
// helper classes
private Context mContext;
private WindowManager mWm;
private Display mDisplay;
private Configuration mConfig;
@rbtr
rbtr / File IO Hello World
Last active August 29, 2015 14:19
FIO Hello World for workshop
package csc171.workshop;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException, FileNotFoundException {
// P1
writeHelloWorld();
readHelloWorld();
// Inverted pendulum (self balancing robot)
int i = 0; // Iteration counter
byte countS = 0; // ??
double zeroOmegaI = 0; // ??
double recOmegaI[10]; // ??
double omegaI = 0; // Rotational velocity
double thetaI = 0; // Rotational angle
double sumPower = 0; // ??
double sumSumP = 0; // ??
const double kAngle = 2.5; // (54/200)
@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)
@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 / 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 / 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 / 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 / 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