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 n-map | |
| "mapping function f on coll xs, using up to n concurrent evaluations. | |
| returns an atom containing unordered results immidietly." | |
| [n f xs] | |
| (let [agents (cycle (map (fn [_] (agent nil)) (range n))) | |
| r (atom [])] | |
| (dorun | |
| (map (fn [a v] | |
| (send-off a | |
| (fn [_ new] (swap! r conj (f new))) |
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
| (ns client-test | |
| (:use [lamina.core] | |
| [aleph.tcp] | |
| [aleph.netty.core] | |
| [gloss.core] | |
| [gloss.io]) | |
| (:gen-class)) | |
| (def chopped-codec | |
| (finite-frame |
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 mapper-map [this ^Text key ^ArchiveReader warc-value ^MapContext context] | |
| (let [i (.iterator warc-value)] | |
| (loop [] | |
| (when (.hasNext i) | |
| (let [^ArchiveRecord l (.next i)] | |
| (println "got " (.available l)) | |
| (recur))))) |
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
| # Count SLOC | |
| export SLF=`mktemp -t cljslocXXXX`; find src test -name "*.clj" | xargs egrep -v "(^[[:space:]]*$|^[[:space:]]*;)" | cut -d: -f1 > $SLF && echo "Files"; uniq -c $SLF; echo "Total" `cat $SLF | wc -l`; rm $SLF |
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
| // Split an rdd according to its partition number | |
| def splitByPartition[T:ClassTag](rdd: RDD[T], hotPartitions:Int): (RDD[T], RDD[T]) = { | |
| val splits = rdd.mapPartitions { iter => | |
| val partId = TaskContext.get.partitionId | |
| val left = if (partId < hotPartitions) iter else empty | |
| val right = if (partId >= hotPartitions) iter else empty | |
| Seq(left, right).iterator | |
| } | |
| val left = splits.mapPartitions { iter => iter.next().toIterator} |
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
| > defaults read com.apple.spaces | |
| { | |
| SpacesDisplayConfiguration = { | |
| "Management Data" = { | |
| "Management Mode" = 1; | |
| Monitors = ( | |
| { | |
| "Current Space" = { | |
| id64 = 4; | |
| type = 0; |
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/sh | |
| # Author: Shlomi Vaknin | |
| # Automatically build and install perf for ubuntu linux kernels. | |
| # Useful if your kernel version does not have the required pacakages (linux-tools and linux-cloud-tools) available on ppa, | |
| SCRIPT=$(readlink -f "$0") | |
| BASEDIR=$(dirname "$SCRIPT") | |
| echo "Automatic perf build and install script. \n" |
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/sh | |
| # Author: Shlomi Vaknin | |
| # Install perf with java flamegraphs on amazon ec2 instances | |
| # let yarn using be able to sudo | |
| sudo -s | |
| echo "yarn ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | |
| # install required packages |
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 bpy | |
| import os | |
| def kmi_props_setattr(kmi_props, attr, value): | |
| try: | |
| setattr(kmi_props, attr, value) | |
| except AttributeError: | |
| print("Warning: property '%s' not found in keymap item '%s'" % | |
| (attr, kmi_props.__class__.__name__)) | |
| except Exception as e: |