This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sys | |
lines = sys.stdin.readlines() | |
for line in lines: | |
chars = list(line) | |
output = "" | |
for char in chars: | |
output += char |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('img[alt="Pants on Fire!"]').remove(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired by http://stackoverflow.com/questions/29757584/handling-by-name-parameters-in-scala-macro | |
import scala.reflect.runtime.universe._ | |
class X { def x(i: => Int, second: String, other: Int*) = i * 2 } | |
val typeSignature = typeOf[X].member(TermName("x")).typeSignature | |
val paramTypes = typeSignature match { | |
case MethodType(params, _) => params map { _.typeSignature } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git show -q | head -n 1 | sed 's/commit //' | tr -d '\n' | xclip -i -selection clipboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bench | |
import ( | |
"errors" | |
"os" | |
"testing" | |
) | |
func TestMain(m *testing.M) { | |
code := m.Run() |
OlderNewer