Skip to content

Instantly share code, notes, and snippets.

View bradurani's full-sized avatar

Brad Urani bradurani

View GitHub Profile
@bradurani
bradurani / create-android-vm.sh
Created October 4, 2013 15:55
Crete and start Android VM
cd ~/android-sdks/tools
./android create avd -n foo -t 1
./emulator -avd foo
@bradurani
bradurani / correlation-notes.txt
Last active December 24, 2015 20:59
Statistical correlation notes
Correlation - describes the relationship between 2 variables. -1 to 1. 0 is independent
The degree to which X and Y vary together, relative to the degree to which X and Y vary independently
r=(covariance of X&Y)/(variance of X&Y)
-Raw score formula
Start with variance = SD^2 = MS = (SS/N) = SUM((X - M)^2) / N
SP = Sum of Cross-Products = SUM((X-Mx)x(Y-My)
r = SPxy/SQRT(SSx x SSy)
Long hand:
@bradurani
bradurani / measurement-statistics.txt
Created October 7, 2013 03:22
Measurement in statistics
*Reliability: Deterministic - same test, same results
Asses by:
-Test / re-test
-Parallel test - use 2 different instruments to measure
-Inter-item - ask several sets of similar questions and correlate answers to questions that are similar
*Validity
-Operationalize a construct = make it observable and quantifiable
Contruct validity:
@bradurani
bradurani / sampling-statistics.txt
Created October 7, 2013 04:17
Sampling in statistics
The biggest thing that influences sampling error is sample size
SE = SD / SQRT(N)
@bradurani
bradurani / regression-line-notes.txt
Created October 13, 2013 22:08
Notes for regression lines
Regression Equation
Y = m + bX + e
Y is a linear function of X
m = intercept
b = slope (rise / run)
e = error ( residual )
Or more common form in stats:
Y = B0 + B1X1 + e
@bradurani
bradurani / pre-commit
Created November 5, 2013 15:59
Run PHP Unit on git commit using phpunit-config.xml in the project root. Add to folder .git/hooks
#!/usr/bin/php
<?php
printf("%sGit pre-commit hook %1\$s", PHP_EOL);
$projectName = basename(getcwd());
exec('phpunit --configuration phpunit-config.xml', $output, $returnCode); // Assuming cwd here
if ($returnCode !== 0) {
$minimalTestSummary = array_pop($output);
printf("Test suite for %s failed: ", $projectName);
printf("( %s ) %s%2\$s", $minimalTestSummary, PHP_EOL);
return false; // exit(1);
@bradurani
bradurani / prepare-commit-msg
Created February 14, 2014 23:50
prepare-commit-msg hook for parsing Pivotal item id from Git branch name and inserting in commit message
#!/bin/sh
# Pivotal Tracker Ticket Extraction
# =================================
# Extract Pivotal Tracker ticket ID from branch name and prepend to commit
# message for GitHub hook.
#
# Takes a commit message like: "A commit comment" for branch "bug-1234-hello"
# and changes it to: "A commit comment [#1234]" for easier commit ticket
# updates.
@bradurani
bradurani / .profile
Created March 10, 2014 22:07
add to .profile to add git branch name to cmd prompt
# git-related functions and aliases
parse_git_head () {
git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)# (git::\1)#'
}
function get_statuscolor {
if [[ "$(git status 2> /dev/null | tail -n1)" != "nothing to commit, working directory clean" ]]
then
echo $RED
else
@bradurani
bradurani / hubot-mac.bash
Last active June 13, 2019 14:45
Hubot dev MacOS setup script
npm install -g hubot coffee-script
brew install redis
sudo nano /Library/LaunchDaemons/io.redis.redis-server.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>io.redis.redis-server</string>
<key>ProgramArguments</key>
BEGIN;
CREATE TABLE cities
(
id serial PRIMARY KEY,
name varchar(255),
allows_drones boolean
);
CREATE TABLE stores
(
id serial PRIMARY KEY,