Skip to content

Instantly share code, notes, and snippets.

View mcdickenson's full-sized avatar

Matt Dickenson mcdickenson

View GitHub Profile
@fonnesbeck
fonnesbeck / install_superpack.sh
Created May 16, 2014 04:10
Script to install Python scientific stack ("Scipy Superpack") using Homebrew and pip. Uses Homebrew's Python 2.7.6. Please report any issues in the comments.
#!/bin/sh
hash brew &> /dev/null
if [ $? -eq 1 ]; then
echo 'Installing Homebrew ...'
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
fi
# Ensure Homebrew formulae are updated
brew update
@kmader
kmader / SparkDemo.scala
Last active June 17, 2020 03:06
A demo script for loading data into Spark and performing a few basic analyzes (from presentation http://4quant.github.io/spark-introduction on slide https://rawgit.com/4Quant/spark-introduction/master/TutorialSlides.html#/26). To get started make a clone of the repository locally (git clone https://gist.github.com/755c2d99c23f4cbe2e74.git) and p…
val inData=sc.textFile("tiny.csv")
// Read the first line and split by commas
import scala.collection.immutable.StringOps
val header= inData.first
val headerLine = header.split(",").map(_.trim.filter(_ != '"'))
// Count lines in the file
inData.count
// Remove the header from the data
val rowData = inData.filter(_ != header).cache
// Divide each row into columns by seperating by commas

Git Cheat Sheet

Commands

Getting Started

git init

or

@pixeltrix
pixeltrix / time_vs_datatime.md
Last active April 23, 2025 13:36
When should you use DateTime and when should you use Time?

When should you use DateTime and when should you use Time?

It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime steps in:

>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000
@johnmyleswhite
johnmyleswhite / statistical_maxims.md
Created December 1, 2015 15:25
Statistical Maxims
  • Correlation is not causation (???)
  • No causation without manipulation. (Holland)
  • All models are wrong, some are useful. (Box)
  • Statistics is the science of uncertainty. (arguably Tukey)
  • Statistics is the science of learning from experience, especially experience that arrives a little bit at a time. (Efron)
@gnachman
gnachman / iterm.scpt
Last active April 8, 2023 23:42
Replace /Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/iterm.scpt with this.
set itermRunning to (application "iTerm" is running)
set scriptPath to quoted form of POSIX path of ((path to me as text) & "::" & "start.sh")
set user_shell to do shell script "dscl /Search -read /Users/$USER UserShell | awk '{print $2}'"
tell application "iTerm"
activate
if not (exists window 1) or (itermRunning = false) then
reopen
end if
@cfrazier91
cfrazier91 / capture_twitter_tweets.ipynb
Created November 19, 2016 15:45
Python for capturing tweets and storing into a csv
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jon-barker
jon-barker / coco2kitti.py
Created January 6, 2017 03:11
Script to convert MS COCO annotations file to Kitti bounding box label files Edit
"""coco2kitti.py: Converts MS COCO annotation files to
Kitti format bounding box label files
__author__ = "Jon Barker"
"""
import os
from pycocotools.coco import COCO
def coco2kitti(catNms, annFile):