Skip to content

Instantly share code, notes, and snippets.

View smithjessk's full-sized avatar

Jess Smith smithjessk

  • United States
View GitHub Profile
import csv
def is_first_of_month(row):
date_string = row[0]
return row[0].split('-')[2] == '01'
def handle_row(row):
if is_first_of_month(row):
open_price, close_price = float(row[1]), float(row[4])
diff = close_price - open_price
@smithjessk
smithjessk / .spacemacs
Last active May 31, 2016 15:28
Spacemacs config
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@smithjessk
smithjessk / ccManipulation.scala
Last active October 15, 2015 21:26
An interesting attempt at companion object manipulation. Note that this gets different results when interpreted and when compiled. companionOf is taken from http://stackoverflow.com/a/9174777
object CC {
def companionOf[T : Manifest] : Option[AnyRef] = try {
val classOfT = implicitly[Manifest[T]].erasure
val companionClassName = classOfT.getName + "$"
val companionClass = Class.forName(companionClassName)
val moduleField = companionClass.getField("MODULE$")
Some(moduleField.get(null))
} catch {
case e => None
}
import scala.annotation.StaticAnnotation
import scala.language.experimental.macros
import scala.reflect.macros.Context
import scala.reflect.ClassTag
import scala.reflect.runtime.universe.Flag._
// Add constructor arguments here.
class expand extends StaticAnnotation {
def macroTransform(annottees: Any*) = macro Expander.expand_impl
}
# Install OpenCV 2.4.9 for Ubuntu
# Derived from https://github.com/jayrambhia/Install-OpenCV/blob/master/Ubuntu/2.4/opencv2_4_8.sh
# @author Jess Smith <smith.jessk@gmail.com>
# @license MIT
arch=$(uname -m)
if [ "$arch" == "i686" -o "$arch" == "i386" -o "$arch" == "i486" -o "$arch" == "i586" ]; then
flag=1
else