This file contains hidden or 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
# Installation | |
brew install libvpx | |
brew install ffmpeg --with-vpx --with-vorbis --with-libvorbis --with-vpx --with-vorbis --with-theora --with-libogg\ | |
--with-libvorbis --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus\ | |
--with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame\ | |
--with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl\ | |
--with-libopus --with-libschroedinger --with-libspeex --with-libtheora --with-libvo-aacenc\ | |
--with-libvorbis --with-libvpx --with-libx264 --with-libxvid --with-libvpx | |
This file contains hidden or 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
val pairs = sc.parallelize(List(("aa", 1), ("bb", 2), | |
("aa", 10), ("bb", 20), | |
("aa", 100), ("bb", 200))) | |
/* aggregateByKey is a generalized version of fold, it takes an initial accumulator (here an empty list), | |
a first lambda function to merge a value to an accumulator, and a | |
second lambda function to merge two accumulators */ | |
pairs.aggregateByKey(List[Int]())( | |
(aggr, value) => value +: aggr, | |
(aggr1, aggr2) => aggr1 ++ aggr2 | |
).foreach(println _) |
This file contains hidden or 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
use std::rc::Rc; | |
use std::cell; | |
use std::ops::{Deref, DerefMut}; | |
pub struct SCell<T>(Rc<cell::RefCell<T>>); | |
pub struct Ref<'a, T: 'a>(cell::Ref<'a, T>); | |
pub struct RefMut<'a, T: 'a>(cell::RefMut<'a, T>); | |
impl<T> SCell<T> { |
This file contains hidden or 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-branch-status - this script prints out pretty git branch sync status reports | |
# * originally by http://github.com/jehiah | |
# * "s'all good!" message by http://github.com/kd35a | |
# * ANSI colors by http://github.com/knovoselic | |
# * formatting, filters, usage, and remotes by http://github.com/bill-auger | |
read -r -d '' USAGE <<-'USAGE' |
This file contains hidden or 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
% multirust run nightly cargo build | |
Compiling regex v0.1.30 | |
Compiling libc v0.1.8 | |
Compiling log v0.3.1 | |
Compiling rand v0.3.8 | |
Compiling getopts v0.2.11 | |
Compiling tempfile v0.3.0 | |
Compiling env_logger v0.3.1 | |
Compiling rusti v0.0.1 (file:///l/src/rust/rusti) |
This file contains hidden or 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 example.statemachine | |
import scalaz.{State, Scalaz}, Scalaz._ | |
object FSM { | |
def apply[I, S](f: PartialFunction[(I, S), S]): FSM[I, S] = | |
new FSM((i, s) => f.applyOrElse((i, s), (_: (I, S)) => s)) | |
private def states[S, O](xs: List[State[S, O]]): State[S, List[O]] = | |
xs.sequence[({type λ[α]=State[S, α]})#λ, O] |
This file contains hidden or 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 shapeless._ | |
import scalaz._ | |
import Scalaz._ | |
object console extends App { | |
trait Foo[A] { | |
type B | |
def value: B |
This file contains hidden or 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
#r @"packages\Eto.Forms.1.3.0\lib\net40\Eto.dll" | |
#r @"packages\Eto.Platform.Windows.1.3.0\lib\net40\Eto.Platform.Windows.dll" | |
open System | |
open Eto.Forms | |
open Eto.Drawing | |
This file contains hidden or 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
(defn qc [op & pairs] | |
(assert (even? (count pairs))) | |
(fn [coll] | |
(doseq [[pred msg] (partition 2 pairs)] | |
(when-not (pred coll) | |
(throw (IllegalArgumentException. msg)))) | |
(apply op coll))) | |
(def f1 (qc + | |
#(= 2 (count %)) "coll must have length 2." |
This file contains hidden or 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
(defn qc [op & pairs] | |
(assert (even? (count pairs))) | |
(fn [coll] | |
(doall | |
(map (fn [[pred msg]] | |
(when-not (pred coll) | |
(throw (IllegalArgumentException. msg)))) | |
(partition 2 pairs)) | |
(apply op coll)))) |