Skip to content

Instantly share code, notes, and snippets.

View skuro's full-sized avatar

Carlo Sciolla skuro

View GitHub Profile
@skuro
skuro / envtest.clj
Created June 27, 2012 23:05
Hanging test
(ns envtest
(:use [clojure.test])
(:require [http.async.client :as http]
[http.async.client.request :as request]))
(def lambdalf-url "http://localhost:9090/lambdalf-webapp")
(def ^:dynamic *client* nil)
(defn- once-fixture [f]
@skuro
skuro / gratz.bf
Created September 12, 2012 10:34
Congratulations!
>++++++++[<++++++++>-]<+++.
>++++++++++[<+++++>-]<------.
-.
-------.
+++++++++++.
>+++++[<--->-]<--.
>++++++[<+++>-]<+.
+.
>+++[<--->-]<.
>+++++[<-->-]<-.
@skuro
skuro / TestSyncBlock.java
Created November 23, 2012 14:00
Performance evaluation of a synchronized blog vs double checked locking
import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
/**
* @author Carlo Sciolla
@skuro
skuro / jetty.xml
Created December 7, 2012 16:50
JackRabbit configuration
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.Server">
<New id="jcr-datastore" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/DataStore</Arg>
<Arg>
<New class="com.mchange.v2.c3p0.ComboPooledDataSource">
<Set name="driverClass">com.mysql.jdbc.Driver</Set>
<Set name="jdbcUrl">jdbc:mysql://localhost:3306/jcr_datastore</Set>
@skuro
skuro / bbrebase.sh
Created December 19, 2012 13:29
git-svn rebase all projects in one shot
#!/bin/sh
#
# Rebases all the incoming changes from remote subversion
# repositories. All repos are expected to be found as first
# children of a root folder. A log file is created per repo.
#
# author: Carlo Sciolla
# Root folder of all modules containing git-svn checkouts
BB_HOME=/Users/skuro/Development/Backbase/git
@skuro
skuro / post-commit-jira.sh
Created February 18, 2013 22:44
A post-commit svn hook to expose links to Trac commits in Jira
#!/bin/sh
# SVN post-commit hook to link revisions to JIRA tickets
#
# Author: Carlo Sciolla <carlo@backbase.com>
# Revision: 0.1
# fill in your Jira credentials and URL:
USER=foo
PASS=test123
private static List<String> ASSOC_NAMES_TO_EXTRACT = Arrays.asList(new String[]{"imageRef","thumbnailRef"});
/**
* Gets a list of associations of type my:imageRef and my:thumbnailRef, given an Alfresco node;
* Implementation is not optimal
* @param nodeRef The Alfresco NodeRef that contains the associations we want to extract
* @return a List of associations of type my:imageRef and my:thumbnailRef
*/
public List<AssociationRef> getAssociations(NodeRef nodeRef) {
List<AssociationRef> associations = serviceRegistry.getNodeService().getTargetAssocs(nodeRef, RegexQNamePattern.MATCH_ALL);
List<AssociationRef> toReturn = new ArrayList<AssociationRef>();
@skuro
skuro / Bean.java
Last active August 29, 2015 13:59
Testing clara rules and queries over POJOs
package tk.skuro;
public class Bean {
private final String _value;
public Bean(String value) {
_value = value;
}
@skuro
skuro / code.clj
Last active August 29, 2015 14:03
Solution for the problems in today's meetup
; https://www.hackerrank.com/challenges/functional-programming-warmups-in-recursion---fibonacci-numbers
(let [fibos (iterate (fn [[a0 a1]] [a1 (+ a0 a1)]) [0 1])
fibo (fn [n] (->> n dec (nth fibos) first))]
(->
(read)
fibo
println))
;https://www.hackerrank.com/challenges/pascals-triangle
(let [k (read)
@skuro
skuro / nonograms.clj
Created December 10, 2014 20:03
Nonograms solver
#_(
Amsterdam Clojurians Dojo#3: A nonogram solver
==============================================
Fork this gist and provide your solution!
)