Skip to content

Instantly share code, notes, and snippets.

View trestrantham's full-sized avatar

Tres Trantham trestrantham

View GitHub Profile
@trestrantham
trestrantham / parse_video.rb
Last active August 29, 2015 13:56
Parse video by scene change
require "csv"
require "streamio-ffmpeg"
require "interactor"
require "command"
require "bigdecimal"
require "bigdecimal/util"
module Video
class DetectScenes
include Interactor

Keybase proof

I hereby claim:

  • I am trestrantham on github.
  • I am tres (https://keybase.io/tres) on keybase.
  • I have a public key whose fingerprint is 9F3C 8FFA B677 9B84 9670 3326 AACE D5DA E82B E29A

To claim this, I am signing this object:

football (master *) → mix deps.get
* Updating excoveralls (git://github.com/parroty/excoveralls.git)
* Updating cesso (git://github.com/meh/cesso.git)
Running dependency resolution
Unlocked: ecto, exprintf, jsex, postgrex
Dependency resolution completed successfully
jsx: v2.0.4
poolboy: v1.2.1
ecto: v0.2.1
exprintf: v0.1.2
defmodule Test do
Module.register_attribute __MODULE__, :config, accumulate: true, persist: false
@before_compile __MODULE__
defmacro __before_compile__(_) do
quote do
Module.put_attribute(__MODULE__, :config, { :foo, "foo" })
end
end
{:ok, manager} = GenEvent.start_link
stream = GenEvent.stream(manager, [mode: :async])
pid1 = spawn_link fn ->
for x <- stream do
IO.puts "pid1 -> sleeping for 1 second then inspecting"
:timer.sleep(1000)
IO.inspect(x)
end
end
@trestrantham
trestrantham / gist:c9abeec38e4f86154f65
Last active August 29, 2015 14:15
Phoenix integration testing
defmodule IntegrationTest do
use ExUnit.Case
use TucoTuco.DSL
setup_all do
{:ok, _} = TucoTuco.start_session :test_browser, :test_session, :phantomjs
host = Integration.Endpoint.config(:url)[:host]
port = Integration.Endpoint.config(:http)[:port]
@trestrantham
trestrantham / gist:8187727
Last active January 1, 2016 18:59
Adding a before filter to module instance methods
# All Walkman commands require the Player to be running so
# let's raise an error if it's not
class Walkman
module Commands
def self.included(base)
base.extend ClassMethods
base.instance_methods(false).each do |method_name|
base.add_player_check(method_name)
end
#!/usr/bin/env ruby
# -*- mode: ruby; coding: utf-8 -*-
require 'opencv'
require 'benchmark'
require "pry"
include OpenCV
def compare_surf_descriptors(d1, d2, best, length)

Keybase proof

I hereby claim:

  • I am trestrantham on github.
  • I am tres (https://keybase.io/tres) on keybase.
  • I have a public key whose fingerprint is CF61 23F0 DB20 C82E 1530 7F15 1CC0 F49A B401 88BA

To claim this, I am signing this object:

const https = require("https");
const KEY = "your-api-key";
const CURRENCY = "BTC";
const INTERVAL = "1h";
const PRICE = 6500;
let body = "";
let candles;