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
def interfaces = NetworkInterface.getNetworkInterfaces() | |
while (interfaces.hasMoreElements()) { | |
def addresses = interfaces.nextElement().getInetAddresses() | |
while (addresses.hasMoreElements()) { | |
println addresses.nextElement().getHostAddress() | |
} | |
} |
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
import java.util.regex.Matcher | |
import java.util.regex.Pattern | |
basedir="src" | |
new File(basedir).eachDirRecurse() { dir -> | |
dir.eachFileMatch(~/.*.jsp/) { file -> | |
println "Examining ${file.getPath()}" | |
file.eachLine { line, number -> | |
alts = line =~ /(?s)alt=\"(.*?)\"/ |
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
def first = """item1 | |
item2 | |
item3""" | |
def second = """item2 | |
item3 | |
item4 | |
item5 | |
item6""" | |
List list1 = makeList(first) |
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
// simple chat server listening on port 8000 | |
// connect as a client with, for example, "netcat localhost 8000" | |
var net = require ('net'); | |
var sockets = []; | |
var s = net.Server(function(socket) { | |
sockets.push(socket); |
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
;; djclojure's solution to Replicate a Sequence | |
;; https://4clojure.com/problem/33 | |
;; start off with repeat to repeat an item x, n times | |
;; e.g. (repeat 3 1) results in (1 1 1) | |
;; then mapcat (map and concat), a given collection onto that in place of x | |
(fn replicate-seq [coll n] | |
(mapcat #(repeat n %) coll)) |
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
;; 4Clojure problem 40: Interpose a Seq | |
;; http://www.4clojure.com/problem/40 | |
;; oh yeah, don't use interpose ;) | |
;; my first attempt.. | |
(fn my-interpose [separator col] | |
(butlast (flatten | |
(map list col (repeat (count col) separator))))) |
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
apply plugin:'groovy' | |
apply plugin:'project-report' | |
buildscript { | |
repositories { | |
maven { | |
name 'clojars' | |
url 'http://clojars.org/repo' | |
} | |
} |
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
(= (__ [1 2 3 4 5 6 7 8] 3) [1 2 4 5 7 8]) | |
(= (__ [:a :b :c :d :e :f] 2) [:a :c :e]) | |
(= (__ [1 2 3 4 5 6] 4) [1 2 3 5 6]) | |
(fn drop-every-n [col n] | |
(keep-indexed | |
(fn [index item] | |
(if | |
(not= 0 (mod (inc index) n)) | |
item |
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 JQ = document.createElement('script'); | |
JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'; | |
JQ.type= 'text/javascript'; | |
document.getElementsByTagName('head')[0].appendChild(JQ); | |
jQuery.noConflict(); | |
var ngml = {}; | |
ngml.msgBox = jQuery('div[id^="[ngml]"] form textarea'); | |
ngml.maxTime=45; | |
ngml.timer=0; |
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
gunzip $1$2 | |
cat $(find ./ -name "$1$2" | sort -V) > $1.log | |
rm $1$2 |
OlderNewer