Skip to content

Instantly share code, notes, and snippets.

View MarcoPolo's full-sized avatar
🌠
Gradatim

Marco Munizaga MarcoPolo

🌠
Gradatim
View GitHub Profile
@MarcoPolo
MarcoPolo / deets.md
Last active December 28, 2015 22:49
Cryptic Crypto Details

Cryptic's Crypto Details:

Registration

In-browser

  • The user chooses a username and password
  • A pub/priv key is generated and stored in a structure called the user blob. (A user will have the option to upload their own set of keys too)
  • The user blob also contains a file tree which will store uploaded files (with their encryption key) and folders (for organizing files).
  • The user blob is encrypted with the PBKDF2 hash of the user's password.
(go
;; Get a worker from the buffered channel
(let [worker (<! servant-channel)]
;; execute the post message for the web worker
(post-message-fn worker (pr-str fn-key) args)
;; Add an event listener for the worker's return message
(.addEventListener worker "message"
#(go
;; Save the data
(>! out-channel (.-data %1))
@MarcoPolo
MarcoPolo / core.cljs
Created September 20, 2013 01:40
Problem with clj->js specifically (and probably more stuff I'm not testing) after the first compilation
(ns test-cljs.core)
(def ^:export t (clj->js {:command "function"}))
(.log js/console t)
(def k (cljs.core.async/chan 3))
;; This doesn't work as expected
(go
(.log js/console "loading: 42")
(>! k 42))
;; This parks when trying to take from the channel
(go
if (typeof(ArrayBuffer) === 'undefined') {
(function(globals){
"use strict";
globals.ArrayBuffer = function(){};
globals.DataView = function(){};
}(this));
}
@MarcoPolo
MarcoPolo / gist:6180338
Last active December 20, 2015 18:59
benchmark of some encryption algorithms
Benchmarking CCM, with 1MB file (patched with arraybuffer)
Total Bytes 1048576 Chunk.js:156
Benchmark took: 48028 ms Chunk.js:157
Total Iterations: 100 iterations Chunk.js:158
Average of : 480.28 ms per 1MB
Benchmarking CCM, with 1MB file (no patch)
Total Bytes 1048576
Benchmark took: 7357 ms
Total Iterations: 10 iterations
@MarcoPolo
MarcoPolo / My Public Key
Created July 16, 2013 16:21
Marco's Pubkey
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.20 (GNU/Linux)
mQINBFHlbycBEADA5sfzue1g6wo7qUm+NmE8p3so6XGJE9lwtNJUimopdEezlffE
OJ6TZ3i72quwTwHNg2Xa4UMy+EUagf+dmawLGskbTPWtHXESny5wAMc98JyTIMvr
4CcBAKhBd2YmLTlF3DP5b00yc2Sf+AgKk8MRz6CCkCHcowHpj0/dFEsmxhqwJL6V
6V5BmMXR1jW2x1N0oVLbsOmVZ2SunrAUEv1XoT/50RopQffEiGdK2qaCGQI9llJK
J0I1+m3PtQPtaQCXPJaHJws6W5PTBXcMPEruiwemudjxmXNLS8zlxog7FyZexFbm
L5IHjQRztkDgvdqpH0jjA/hGcxPXtHIVR6+A+lc9kHlgrgGXJQ/ijn+alK3w5pYB
97t49JRaL5PAqRSKtRK/t9+cnP0KWGEgsEV5dmoGAYa25Qbqh6Ed2rj3/zyITT35
@MarcoPolo
MarcoPolo / rps
Last active December 19, 2015 14:49
My first go
//My first Go program w/o any internet access
package main
import (
"net/http"
"fmt"
)
type Game struct {
the -> converts (-> x (f a) (g b)) into (g (f x a) b)
the ->> converts (->> x (f a) (g b)) into (g b (f a x) )
(defn get-current-price
"Gets the current price from a response"
[response]
(->
(get response :body)
(parse-string)
(get-in ["return" "last" "display"])
(println)))