Skip to content

Instantly share code, notes, and snippets.

View cazacugmihai's full-sized avatar

Mihai Cazacu cazacugmihai

View GitHub Profile
@cazacugmihai
cazacugmihai / performanceprofiling.js
Created September 26, 2012 17:03 — forked from bcherry/performanceprofiling.js
JavaScript: performance
var performance = (function () {
var my = {};
// Wrap a function body in this to return a copy that instruments itself
// If you want this to be useful, you should give your profiled function a name,
// otherwise it will be identified as "", which is less than useful.
my.profile = function (func) {
return function () {
var start = new Date().getTime(),
time,
@cazacugmihai
cazacugmihai / gist:3789226
Created September 26, 2012 17:07 — forked from Zaorish/gist:1993530
CSS: Image Replace
.g-imageReplace{
border:0;
font: 0/0 a;
text-shadow:none;
color:transparent;
background-color:transparent;
}
@GrabResolver(name='hazelcast', root='https://oss.sonatype.org/content/repositories/snapshots', m2Compatible=true)
@Grab('com.hazelcast:hazelcast:3.2-SNAPSHOT')
import com.hazelcast.config.Config
import com.hazelcast.config.NearCacheConfig
import com.hazelcast.core.Hazelcast
import com.hazelcast.core.HazelcastInstance
import java.util.concurrent.ConcurrentMap
import static com.hazelcast.config.PartitionGroupConfig.MemberGroupType.HOST_AWARE
Menu
-------
1. Put
2. Get
3. Remove
0. Quit
Your option: Jan 27, 2014 8:51:35 AM com.hazelcast.cluster.ClusterService
FINEST: [172.28.124.252]:5701 [sessions] [3.2-SNAPSHOT] MasterConfirmation has been received from Member [172.28.124.242]:5701
1
key: l2
/* tested on PhantomJS 1.6 */
var page = require('webpage').create(), loadInProgress = false, fs = require('fs');
var htmlFiles = new Array();
// console.log(fs.workingDirectory);
// console.log(phantom.args[0]);
var curdir = phantom.args[0] || fs.workingDirectory;
var curdirList = fs.list(curdir);
@cazacugmihai
cazacugmihai / hazelcast.groovy
Created February 27, 2014 12:25
hazelcast - issue #1688
// start with: groovy -Djava.util.logging.config.file=logging.properties hazelcast.groovy
@GrabResolver(name='hazelcast', root='https://oss.sonatype.org/content/repositories/snapshots', m2Compatible=true)
@Grab('com.hazelcast:hazelcast:3.1.6')
import com.hazelcast.config.Config
import com.hazelcast.core.Hazelcast
import com.hazelcast.core.HazelcastInstance
import java.util.concurrent.ConcurrentMap
import static com.hazelcast.config.PartitionGroupConfig.MemberGroupType.HOST_AWARE
/*
* This work is licensed under the Creative Commons Attribution 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/
* or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
*/
/*
* Define your version here
*/
@cazacugmihai
cazacugmihai / cors-nginx.conf
Last active September 8, 2015 12:08 — forked from michiel/cors-nginx.conf
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@cazacugmihai
cazacugmihai / PasswordUtils.java
Last active September 21, 2015 09:21 — forked from ToastShaman/PasswordUtils.java
A utility class for hashing passwords using PBKDF2 with BouncyCastle.
package com.zuhlke.lsapi;
import org.bouncycastle.crypto.PBEParametersGenerator;
import org.bouncycastle.crypto.digests.SHA3Digest;
import org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.prng.DigestRandomGenerator;
import java.util.Base64;
# +-----------+-----------+
# | 1_1 | 2_1 |
# | | |
# +-----+-----+-----+-----+
# | 1_2 | 1_3 | 2_2 | 2_3 |
# | | | | |
# +-----+-----+-----+-----+
# | 3_1 | 4_1 |
# +-----------+ |
# | 3_2 +-----+-----+