Skip to content

Instantly share code, notes, and snippets.

View jrumbut's full-sized avatar

Joshua Rumbut jrumbut

  • UMass Chan Medical School
  • Worcester, MA
View GitHub Profile
@jrumbut
jrumbut / nnet.R
Created December 5, 2017 21:43 — forked from primaryobjects/nnet.R
Neural network (nnet) with caret and R. Machine learning classification example, includes parallel processing.
library(caret)
library(doParallel)
registerDoParallel(cores = 2)
# Read data.
data <- read.csv('train.csv')
test <- read.csv('test.csv')
# Set classification column to factor.
@jrumbut
jrumbut / CopyOnConditional.gs
Created June 29, 2016 13:32
Google Sheets Copy On Condition
function copyOnConditional() {
var ss=SpreadsheetApp.getActiveSpreadsheet();// some global variables
var master = ss.getSheetByName('Raw Data');
var colWidth = master.getMaxColumns();
//function copyRowsOnCondition() {
var data = master.getDataRange().getValues();
for(n=2;n<data.length;++n){
@jrumbut
jrumbut / git-multi-status.sh
Last active June 22, 2016 18:09 — forked from ramananbalakrishnan/git-multi-status.sh
check the status of all git repositories located under a given directory (default: cwd)
#!/bin/bash
# usage: $0 [source_dir] ...
# where source_dir args are directories containing git repositories
red="\033[00;31m"
green="\033[00;32m"
yellow="\033[00;33m"
blue="\033[00;34m"
purple="\033[00;35m"
cyan="\033[00;36m"
@jrumbut
jrumbut / docker-net.sh
Created April 13, 2016 16:34
Helpful Docker function, gives you Hostname (often shortened container id), name, IP address, and port bindings for all running containers
#defines function for later use, put it in .bashrc or similar
#usage: docker-net
#output:
#bdc5fb58bc94 /adoring_euler 172.17.0.3 map[8888/tcp:[{ 8888}]]
#c7591aa275ff /hopeful_davinci 172.17.0.2 map[6006/tcp:[{ 32769}] 8888/tcp:[{ 80}]]
docker-net() {
docker inspect --format '{{ .Config.Hostname }} {{ .Name }} {{ .NetworkSettings.IPAddress }} {{ .HostConfig.PortBindings }}' $(docker ps -q);
}

Keybase proof

I hereby claim:

  • I am jrumbut on github.
  • I am jrumbut (https://keybase.io/jrumbut) on keybase.
  • I have a public key whose fingerprint is 8870 4B2A CFA1 C0BE F83A FBBC EB89 F978 197C 11BA

To claim this, I am signing this object:

@jrumbut
jrumbut / taiga-report-tags.sh
Created October 27, 2015 19:09
Sorted list of most common tag (groupings) out of Taiga's somewhat unusual report format
#/bin/bash
cat ./issues.csv | awk -F",," '{print $3}' | sort | awk '/^[a-z"]/' | uniq -c | sort -r
@jrumbut
jrumbut / hash-delimited-apache-logs
Last active October 6, 2015 20:02
Get Hash Delimited Fields From Apache Logs
#!/bin/bash
#Usage cat access.log | ./hash-delimited_apache_logs
sed 's/^\(.*\) \(.*\) \(.*\) \[\(.*\)\] \"\([[:alpha:]]\+\) \(.*\) HTTP\/1\.1\" \(.*\) \(.*\) \"\(.*\)\" \"\(.*\)\"$/\1#\2#\3#\4#\5#\6#\7#\8#\9#\10/g'
@jrumbut
jrumbut / duplicate-count.sh
Last active September 21, 2015 18:43
Find duplicates in an Apache log file using bash (sorted, with counts, OSX compatible)
cat 404.log | awk '{print $2}' | sort | uniq -c | grep -v '^ *1 ' | sort
@jrumbut
jrumbut / 500-404-apache-error-report.sh
Last active February 14, 2021 21:55
Get 404 and 500 errors from apache error log
cat access.log.1 | grep " 500 " | awk -F'"' '{print $2,",",$4,",",$6}' > /home/ubuntu/500.log
cat access.log.1 | grep " 404 " | awk -F'"' '{print $2,",",$4,",",$6}' > /home/ubuntu/404.log
@jrumbut
jrumbut / git-last-commit.sh
Created July 20, 2015 20:21
See last git commit hash and message
git log -1 --oneline
#see commit message only:git log -1 --pretty=%B
#man git-log