Skip to content

Instantly share code, notes, and snippets.

View siscia's full-sized avatar

Simone Mosciatti siscia

View GitHub Profile
>(def m (matrix [[1 2 3 4]
[5 6 7 8]]))
>(reshape m [2 2])
[[1 2]
[5 6]]
or
[[1 2]
[3 4]]
(require 'package)
(add-to-list 'package-archives
'("marmalade" .
"http://marmalade-repo.org/packages/"))
(package-initialize)
(add-to-list 'load-path "~/.emacs.d/")
;;(require 'auto-complete-config)
;;(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")
; nREPL 0.1.6
user> (ns parallel-colt-matrix.vector)
nil
parallel-colt-matrix.vector> (use 'criterium.core)
nil
parallel-colt-matrix.vector> (let [a (get-vector (take 10 (repeatedly #(Math/random))))
b (get-vector (take 10 (repeatedly #(Math/random))))]
(bench (dotimes [i 1e3] (matrix-add a b))))
Evaluation count : 10560 in 60 samples of 176 calls.
Execution time mean : 6.241243 ms
parallel-colt-matrix.vector> (ns parallel-colt-matrix.matrix)
nil
parallel-colt-matrix.matrix> (use 'criterium.core)
nil
parallel-colt-matrix.matrix> (let [a (get-matrix (vec (partition 10 (take 1e1 (repeatedly #(Math/random))))))
b (get-matrix (vec (partition 10 (take 1e1 (repeatedly #(Math/random))))))]
(quick-bench (dotimes [i 1e3] (matrix-add a b))))
WARNING: Final GC required 28.23080534636936 % of runtime
user> (use 'parallel-colt-matrix.matrix)
nil
user> (use 'criterium.core)
nil
user> (use 'clojure.core.matrix.protocols)
nil
user> (let [a (get-matrix (vec (partition 10 (take 1e1 (repeatedly #(Math/random))))))
b (get-matrix (vec (partition 10 (take 1e1 (repeatedly #(Math/random))))))]
(quick-bench (dotimes [i 1e3] (matrix-add a b))))
WARNING: Final GC required 20.85847607060592 % of runtime
(quick-bench (dotimes [_ 1e3] (doall (map + (take 1e4 (repeatedly #(Math/random)))
(take 1e4 (repeatedly #(Math/random)))))))
Evaluation count : 6 in 6 samples of 1 calls.
Execution time mean : 4.955435 sec
Execution time std-deviation : 60.297179 ms
Execution time lower quantile : 4.884205 sec ( 2.5%)
Execution time upper quantile : 5.017391 sec (97.5%)
nil
user> (quick-bench (dotimes [_ 1e3] (doall (pmap + (take 1e4 (repeatedly #(Math/random)))
[{u'picture': <open file '<fdopen>', mode 'w+b' at 0x2856780>, u'link': u'http://www.facebook.com/MascagniTappeti.it?ref=stream', u'created_time': u'2013-04-05T13:58:18+0000', u'type': u'link', u'id': u'100001211587716_530489450334770'},
{u'picture': <open file '<fdopen>', mode 'w+b' at 0x2856810>, u'link': u'http://www.facebook.com/pages/La-performance-sessuale-di-merda-PSDM/496853043711023?ref=stream', u'created_time': u'2013-04-04T12:57:24+0000', u'type': u'link', u'id': u'100001211587716_530080327042349'},
{u'story': u'Simone Mosciatti and CubaLibro Siena are now friends.', u'story_tags': [{u'length': 16, u'name': u'Simone Mosciatti', u'offset': 0, 'pic_square': <open file '<fdopen>', mode 'w+b' at 0x2856930>, u'type': u'user', u'id': u'100001211587716'},
{u'length': 15, u'name': u'CubaLibro Siena', u'offset': 21, 'pic_square': <open file '<fdopen>', mode 'w+b' at 0x28568a0>, u'type': u'user', u'id': u'100003739931055'}], u'created_time': u'2013-04-04T02:44:26+0000', u'type': u'status', u'id': u'100
import facebook
import time
import datetime
from StringIO import StringIO
from tempfile import NamedTemporaryFile
from urllib2 import urlopen, HTTPError
def simple_request(path):
"""Fetches the given path in the Graph API.
(ns project.logging
(:require [clojure.tools.logging :refer [info warn]]
[dire.core :refer [with-pre-hook!]]
[project.destructure :refer :all]))
(with-pre-hook! #'destructure-cow-list
(fn [connection]
(info connection "is listing cows.")))
(with-pre-hook! #'destructure-cow-create
@siscia
siscia / HackerSchool in Italy.md
Created June 3, 2013 14:50
Proseguimento della discussione sul forum python italiano: http://www.python-it.org/forum/index.php?topic=7803.0

Io/Bob/siscia

Ciao a tutti,

stavo pensando e soppesando l'idea di creare una "mini" HackerSchool [1] qui in Italia per questa estate, voi che ne pensate ? Qualcuno sarebbe interessato ?

Pensieri ?

[1] https://www.hackerschool.com/