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
#define INF 9999999999 | |
#define PLATEAU 0 | |
#define BLOCK_SIZE 6 | |
// Convert 2D index to 1D index. | |
#define INDEX(j,i,ld) ((j) * ld + (i)) | |
// Convert local (shared memory) coord to global (image) coordinate. | |
#define L2I(ind,off) (((ind) / BLOCK_SIZE) * (BLOCK_SIZE - 2)-1+(off)) |
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
$ /usr/libexec/java_home -v '1.6*' | |
=> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home | |
$ export JAVA_HOME="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home" | |
$ java -version | |
=> java version "1.6.0_37" | |
=> Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909) | |
=> Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode) |
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
require 'graph-rank' | |
require 'treat' | |
# Implements the PageRank algorithm for | |
# unsupervised extractive summarization. | |
# | |
# Reference: R. Mihalcea and P. Tarau, “TextRank: | |
# Bringing Order into Texts,” in Proceedings of | |
# EMNLP 2004. Association for Computational | |
# Linguistics, 2004, pp. 404–411. |
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
BigInteger.prototype.toUByteArray = function (length) { | |
var bytes = this.toByteArray(); | |
if (bytes.length == length + 1 && bytes[0] == 0) | |
bytes.shift(); | |
return bytes; | |
}; |
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
salt: "883c4998" | |
A: "da4cf6bd34de1311ae3b112073e46b6cfd9fa5fd08eb64637b270a737bb4893440d320188eb40a74561fc0e007c56629c2ad3e3ad6f7438fe7659dddbebd30c403bf53d1fbc07cf6a876df9af3b08b425283bc4c9e42b544a83825cae6831760cc25f6b00129082c231f6b8577d7cd9a883102e163b24a18640435c35ca80d1f" | |
B: "5189bc826ba7c7c5fe727adee944f0883f23c3bedd93b94ccb3dd85b1256d3166948c04e77ed56506e50d609c684b4958e0147a435635c8d4e7286d16f0b20c43bf8378447912135377a8a9ddc84eae922b90193822aaf3cb5450ce2d60aefbd0a82fc277962d2ea82ca33da2bbf88755bc8f4fc7327b990f5b7daa9159094ff" | |
V: "852d1e42f4108cabb5fd47d9e0222487c5fea9deab76ae5ea8ab1263191d2a2c40be4f58669994da9ea762391bac6ba66f837bf3ef03d077fa4257703deb4fed914e7e6b47e02b73d4edc629370ce3926d8bbc6d52b06a39970b22a53aafb8f5c7fb16f4a4b06ed96a8608549a120d0f6c20b8ee1ff865aa477614bff9b8bc5a" |
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
var key = 'password'; | |
$.encAjax = function (url, options) { | |
options.data = options.data || {}; | |
var data = JSON.stringify(options.data); | |
var encryptedData = sjcl.encrypt(key, data); | |
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
# Results: | |
# +------------+--------------+------------+ | |
# | Type | Uncompressed | Compressed | | |
# +------------+--------------+------------+ | |
# | Plaintext | 649779 | 251901 | | |
# | Ciphertext | 649792 | 625780 | | |
# +------------+--------------+------------+ | |
require 'openssl' |
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
{ | |
"iv": "Tbn0mZxQcroWnq4g/Pm+Gg", | |
"v": 1, | |
"iter": 1000, | |
"ks": 128, | |
"ts": 64, | |
"mode": "ccm", | |
"adata": "", | |
"cipher": "aes", | |
"salt": "pMQh7m9Scds", |
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
elementInViewport: function(el){ | |
var r, html; | |
if ( !el || 1 !== el.nodeType ) { return false; } | |
html = document.documentElement; | |
r = el.getBoundingClientRect(); | |
return ( !!r | |
&& r.bottom >= 0 | |
&& r.right >= 0 |