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
/** | |
* Pass each value in the key-value pair RDD through a map function without changing the keys; | |
* this also retains the original RDD's partitioning. | |
*/ | |
def mapValues[U](f: V => U): RDD[(K, U)] = self.withScope { | |
val cleanF = self.context.clean(f) | |
new MapPartitionsRDD[(K, U), (K, V)](self, | |
(context, pid, iter) => iter.map { case (k, v) => (k, cleanF(v)) }, | |
preservesPartitioning = true) | |
} |
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
/** | |
* Return a new RDD containing only the elements that satisfy a predicate. | |
*/ | |
def filter(f: T => Boolean): RDD[T] = withScope { | |
val cleanF = sc.clean(f) | |
new MapPartitionsRDD[T, T]( | |
this, | |
(context, pid, iter) => iter.filter(cleanF), | |
preservesPartitioning = true) | |
} |
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
/** | |
* An RDD that applies the provided function to every partition of the parent RDD. | |
*/ | |
private[spark] class MapPartitionsRDD[U: ClassTag, T: ClassTag]( | |
var prev: RDD[T], | |
f: (TaskContext, Int, Iterator[T]) => Iterator[U], // (TaskContext, partition index, iterator) | |
preservesPartitioning: Boolean = false) | |
extends RDD[U](prev) { | |
... | |
} |
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 main | |
import "fmt" | |
type Game struct { | |
Board [][]int | |
} | |
func (g *Game) semiDiagonalScore(rowDirection int, colDirection int, row int, col int) int { | |
fmt.Printf("checking direcetion %d,%d\n", rowDirection, colDirection) |
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
Show hidden characters
{ | |
"always_show_minimap_viewport": true, | |
"auto_complete_commit_on_tab": true, | |
"auto_complete_selector": "source - comment, meta.tag - punctuation.definition.tag.begin", | |
"auto_complete_triggers": | |
[ | |
{ | |
"characters": "ng-controller=\"*", | |
"selector": "punctuation.definition.string" | |
} |
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
Adult | |
Aeroplane | |
Air | |
Aircraft Carrier | |
Airforce | |
Airport | |
Album | |
Alphabet | |
Apple | |
Arm |
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
๐โ๐๐๐โ ๐ฆ๐ฆ๐ง๐ง๐ง๐ฆ๐ฆ๐ง๐ง๐ โ ๐ โ๐ด |
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
AUDIO="file.m4a" | |
INPUT=$(ffprobe -v error -select_streams a:0 -show_chapters -of csv=print_section=1 AUDIO); | |
paste <(echo "$INPUT" | cut -d ',' -f 5 | cut -d '.' -f 1 | while read line; do date -d @$line; done) <(echo "$INPUT" | cut -d ',' -f 8) |
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
g6Rib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEgHFs/SeqaQ/FiQRHH1J2S72gtZL1RurBuQvdor18KwcMKp3BheWxvYWTFAut7ImJvZHkiOnsia2V5Ijp7ImVsZGVzdF9raWQiOiIwMTAxZjI0NmY1MGJmYzRiOWMwODQ1NTVkYjA1NGJhNmRhMTQ1YzhjOWY3NmNhNDEyMDQ4ZjM1NzI2ODNjY2E4MGY1NDBhIiwiaG9zdCI6ImtleWJhc2UuaW8iLCJraWQiOiIwMTIwMWM1YjNmNDllYTlhNDNmMTYyNDExMWM3ZDQ5ZDkyZWY2ODJkNjRiZDUxYmFiMDZlNDJmNzY4YWY1ZjBhYzFjMzBhIiwidWlkIjoiOTRmMzY3MmFkZDE0NDJhOTI5MTljZDk5YjgxZmQxMTkiLCJ1c2VybmFtZSI6ImNlcmlzaWVyIn0sInNlcnZpY2UiOnsibmFtZSI6ImdpdGh1YiIsInVzZXJuYW1lIjoiY2VyaXNpZXIifSwidHlwZSI6IndlYl9zZXJ2aWNlX2JpbmRpbmciLCJ2ZXJzaW9uIjoxfSwiY2xpZW50Ijp7Im5hbWUiOiJrZXliYXNlLmlvIGdvIGNsaWVudCIsInZlcnNpb24iOiIxLjAuNSJ9LCJjdGltZSI6MTQ1MjQ2NjMwNiwiZXhwaXJlX2luIjo1MDQ1NzYwMDAsIm1lcmtsZV9yb290Ijp7ImN0aW1lIjoxNDUyNDY2MzAwLCJoYXNoIjoiYzc2NGI5ZTA2MGQ0Y2M3YWQwZThhOTBlN2M5ZWVhYjIzZTViM2FhNDY5ZDgxOGVhMWNmOTk0NWYwNWZjYzZiZDRiNDNmZDhjZjJmZThiZTc2YjNmNzMzYmM4NzEzNWJmYjRhZDg2OGZiZGNhNDJkMWQzZWU2NmVkNzYyMDE5OTEiLCJzZXFubyI6MzQ2NjUzfSwicHJldiI6ImM1ZWIzOGI3MDZlMGRkM2RmNWRmNzAzMjFhNzVhNjliNDEz |
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 | |
import sys | |
# Reads input generated from ffprobe. Example below. | |
# ffprobe -v error -select_streams a:0 -show_entries stream=nb_read_frames ABGT160_847378.m4a | |
reader = csv.reader(sys.stdin, delimiter=',') | |
audio_file = sys.argv[1] | |
for row in reader: |