Skip to content

Instantly share code, notes, and snippets.

View paulosuzart's full-sized avatar

Paulo Suzart paulosuzart

View GitHub Profile
#!/usr/bin/python
import sys
import shutil
def copyr(f,t,fnd,repl):
""" A simple string replace in files. You may wish to extend it for regex."""
while f:
line = f.readline()
if len(line) == 0:
#in a clojure repls sterted through java -cp {path-to-clojure.jar}:{path-to-clojure-contrib.jar} clojure.main
user=> (use 'clojure.contrib.string)
java.lang.VerifyError: class clojure.contrib.string$loading__4403__auto__ overrides final method meta.()Lclojure/lang/IPersistentMap; (NO_SOURCE_FILE:0)
projects = {'ProjectA' : {'deps' : ['ProjectB']},
'ProjectB' : {'deps' : None},
'ProjectC' : {'deps' : ['ProjectA']}}
cont = 0
def deploy(name, desc):
"""
Detects the order of deploy for projects in a dict.
Each dic entry is the name of Projet : {desc}, where desc is a dict containing:
(ns deps)
(def projects {:ProjectA {:deps [:ProjectB]
:desc "Web tier"}
:ProjectB {:desc "Service tier"}
:ProjectC {:deps [:ProjectB]
:desc "Persistence"}})
(defn dep [s name sup]
(println "ini" s name sup)
from fabric.operations import sudo, local, put, run
from fabric.api import *
from fabric.context_managers import cd
import logging
env.cwd = '/home/user'
env.hosts = ['linx']
{- learning from http://learnyouahaskell.com/ -}
doubleMe x = x + x
doubleSmall x = if x > 100
then x
else x * 2
len xs = sum [1 | _ <- xs]
per = ("Paulo", 28)
removeNonUppercase :: [Char] -> [Char]
removeNonUppercase st = [c | c <- st, elem c ['A'..'Z']]
a;b;c;d
1;3;4;2
2;3;4;1
2;4;3;1
4;3;2;1
4;1;3;2
4;3;2;1
4;3;2;1
1;3;2;4
2;1;4;3
(ns lemo
(:use (incanter core io charts stats)))
(def lemo (read-dataset "lemo.txt"
:header true
:delim \;))
(defn bar [data title]
(bar-chart ["p" "a" "m" "c"]
data
(ns ^{:doc "Helper functions that extends existing Clojure"
:author "Paulo Suzart"}
collext)
(defn
^{:doc "Returns a Vector containing f applied to every argument.
The f function is supposed to take one argument"
:test (fn []
(is (= [1 4 9 16 25 36] (mvector #(* % %) 1 2 3 4 5 6)))
(is (= ["TEST"] (mvector #(.toUpperCase %) "test"))))}
2010-09-16 10:38:39.152/670.731 Oracle Coherence GE 3.5.3/465 <Error> (thread=Invocation:Management, member=4):
java.lang.NullPointerException
at com.tangosol.coherence.component.net.management.model.localModel.ClusterNodeModel.getBufferPublishSize(ClusterNodeModel.CDB:4)
at com.tangosol.coherence.component.net.management.model.localModel.ClusterNodeModel.writeExternal(ClusterNodeModel.CDB:5)
at com.tangosol.util.ExternalizableHelper.writeExternalizableLite(ExternalizableHelper.java:1994)
at com.tangosol.util.ExternalizableHelper.writeObject(ExternalizableHelper.java:2364)
at com.tangosol.io.DefaultSerializer.serialize(DefaultSerializer.java:51)
at com.tangosol.coherence.component.util.daemon.queueProcessor.Service.writeObject(Service.CDB:4)
at com.tangosol.coherence.component.net.Message.writeObject(Message.CDB:1)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.InvocationService$InvocationResponse.write(InvocationSer