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
/** | |
* Throw even checked exceptions without being required | |
* to declare them or catch them. Suggested idiom: | |
* <p> | |
* <code>throw sneakyThrow( some exception );</code> | |
*/ | |
static public RuntimeException sneakyThrow(Throwable t) { | |
// http://www.mail-archive.com/javaposse@googlegroups.com/msg05984.html | |
if (t == null) | |
throw new NullPointerException(); |
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
;;; This was installed by package-install.el. | |
;;; This provides support for the package system and | |
;;; interfacing with ELPA, the package archive. | |
;;; Move this code earlier if you want to reference | |
;;; packages in your .emacs. | |
(add-to-list 'load-path "~/.emacs.d/marmalade") | |
(require 'package) | |
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) | |
(package-initialize) | |
';;使用缩写模式 |
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
(ns joy.q) | |
;; nil | |
(defn nom [n] (take n (repeatedly #(rand-int n)))) | |
;; #'joy.q/nom | |
(defn sort-parts [work] | |
(lazy-seq | |
(loop [[part & parts] work] ;; Pull apart work - note: work will be a list of lists. | |
(if-let [[pivot & xs] (seq part)] ;; This blows up unless work was a list of lists. |
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
(ns monads | |
(:require clojure.set)) | |
(declare ^:dynamic return | |
^:dynamic bind) | |
(defn lift-inc [v] | |
(return (inc v))) | |
(defn m-add [mv n] |
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
(defn invoke [fs] | |
(map #(deref % 200 nil) (map future-call fs))) |
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
#### | |
# Description:a ruby script to monitor metaq queue size | |
# Requirements: zookeeper | |
# sudo gem install zookeeper | |
# | |
##### | |
require 'rubygems' | |
require 'zookeeper' | |
require '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
#### | |
# Description:a ruby script to sync consumers offsets with brokers offsets. | |
# Requirements: zookeeper | |
# sudo gem install zookeeper | |
# | |
##### | |
require 'rubygems' | |
require 'zookeeper' | |
require '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
## Description: A ruby script to parse metaq data | |
## Requirements: sudo gem install bindata | |
require 'rubygems' | |
require 'bindata' | |
class Attribute < BinData::Record | |
endian :big | |
int32 :len,:initial_value => 0 | |
string :attribute,:read_length => :len |
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
#### | |
# Description:a nagios plugin script to monitor solr cloud cluster | |
# Requirements: zookeeper | |
# sudo gem install zookeeper | |
# sudo gem install rsolr | |
# | |
##### | |
require 'rubygems' | |
require 'zookeeper' | |
require 'rsolr' |
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
package net.rubyeye.xmemcached.impl; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.Random; | |
import com.google.code.yanf4j.core.Session; |
OlderNewer