Skip to content

Instantly share code, notes, and snippets.

View skuro's full-sized avatar

Carlo Sciolla skuro

View GitHub Profile
package foo;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
/**
#
# Debian useful commands
#----
# look for eventually installed packages that provide filename.ext
dpkg -D filename.ext
#
# Various stuff
#----
<%--
Original source: http://paste.lisp.org/display/71541
--%>
<%--
This JSP page is intended to start swank-clojure
in a running Java system executed in an HTTP
container like Tomcat, so that you can connect to
it from SLIME and interactively inspect, control and
modify it.
(ns skuro.alfresco.clojure
:import (org.alfresco.util ApplicationContextHelper ApplicationContextHelper$RunAsWork)
(org.alfresco.repo.transaction RetryingTransactionHelper RetryingTransactionHelper$RetryingTransactionCallback))
;; this is problematic: it looks like swank is launched in a separated class loader!
;; this usually results in the spring ctx to be recreated
(def ctx (. ApplicationContextHelper getApplicationContext))
(defn run-as [user work]
(. AuthenticationUtil runAs
$ sc-server
SproutCore v1.4.1 Development Server
Starting server at http://0.0.0.0:4020 in debug mode
To quit sc-server, press Control-C
>> Thin web server (v1.2.7 codename No Hup)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4020, CTRL+C to stop
LocalJumpError: no block given
/Library/Ruby/Gems/1.8/gems/sproutcore-1.4.1/lib/sproutcore/models/manifest.rb:26:in `each'
/Library/Ruby/Gems/1.8/gems/sproutcore-1.4.1/lib/sproutcore/models/manifest.rb:26:in `visible'
@skuro
skuro / Tak.java
Created January 20, 2011 22:35
Simple functions to assess clojure perf
public class Tak {
static Integer tak (Integer x, Integer y, Integer z) {
if (y >= x) {
return z;
}
return tak (tak (x - 1, y, z), tak (y - 1, z, x), tak (z - 1, x, y));
}
@skuro
skuro / sample.get.clj
Created May 10, 2011 18:04
Clojure WebScript sample
;; ns forms are currently useless
;; Import the protocol
(import '[spring.surf.webscript WebScript])
;; Let's make use of some utility functions
(require '[spring.surf.webscript :as w])
;; Concrete WebScript implementation
(deftype SampleWebScript
@skuro
skuro / sample.clj
Created September 4, 2011 22:18
Alfresco repository tree-seq in Clojure
(ns alfresco.sample
(:require [alfresco.nodes :as n]
[alfresco.model :as m]
[alfresco.auth :as a]))
;; Creates a tree-seq to navigate a repository sub branch
(defn ts
[root]
(a/as-admin ;; in a normal context, you should already be authenticated
(let [user (a/whoami) ;; store the currently authenticated user, needed by the following closures
@skuro
skuro / Questions
Created September 6, 2011 13:22
GOTO Amsterdam
Day job: Senior R&D Developer
What is your language of choice: Java/Clojure
Open Source contributions: lambdalf, maven-alfresco-archetypes
How do you use GitHub: All the OpenSource code I can possibly push in there, \
my personal CV, \
snippets and sample projects backing up my blog posts, \
keep myself up to date with tons of OpenSource projects, \
meet fellow techies, \
earn badges on some other social coding sites, \
give extra points to interviewees with an in-shape GitHub account.
@skuro
skuro / ObjectInfo.java
Created September 20, 2011 08:46
Perf issue
// just to show the calls in the wtf.java file
public String getId() {
return id;
}