Skip to content

Instantly share code, notes, and snippets.

View l1x's full-sized avatar
🏠
Working from home

Istvan l1x

🏠
Working from home
View GitHub Profile
GET /items #=> index
GET /items/1 #=> show
GET /items/new #=> new
POST /items #=> create
DELETE /items/1 #=> destroy
http://cloc.sourceforge.net v 1.58 T=62.0 s (74.3 files/s, 21352.3 lines/s)
--------------------------------------------------------------------------------
Language files blank comment code
--------------------------------------------------------------------------------
Python 2908 86303 115139 383318
HTML 909 16731 9323 250064
C 87 20338 75217 146763
Java 68 12359 6119 73661
Javascript 160 5396 5822 40424
CSS 90 3668 1213 19838
(defmulti affiliate-fee :referrer)
(defmethod affiliate-fee :mint.com [user]
(fee-amount 0.03 user))
(defmethod affiliate-fee :google.com [user]
(fee-amount 0.01 user))
(defmethod affiliate-fee :default [user]
(fee-amount 0.02 user))
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.compress.SnappyCodec
import org.apache.hadoop.io.compress.CompressionCodec;
curl -XGET -i http://127.0.0.1:8098/buckets/test/keys?keys=stream
HTTP/1.1 200 OK
Vary: Accept-Encoding
Transfer-Encoding: chunked
Server: MochiWeb/1.1 WebMachine/1.10.0 (never breaks eye contact)
Date: Fri, 14 Mar 2014 15:21:41 GMT
Content-Type: application/json
curl: (18) transfer closed with outstanding read data remaining
(for [[k v] [[1 2] ["x" "y"]] :let [a (str k)]] a)
(def sample-data [
{ :id "bf9eb73e-a8c8-11e3-9be7-425861b86ab6" :type "PrestoDB"
:version "0.60" :host "10.3.0.1" :port "8080"}
{ :id "bf9eba36-a8c8-11e3-9be7-425861b86ab6" :type "PrestoDB"
:version "0.60" :host "10.3.0.2" :port "8080"}
{ :id "bf9ebc5c-a8c8-11e3-9be7-425861b86ab6" :type "PrestoDB"
:version "0.60" :host "10.3.0.3" :port "8080"}
{ :id "bf9ebe5a-a8c8-11e3-9be7-425861b86ab6" :type "PrestoDB"
:version "0.60" :host "10.3.0.4" :port "8080"}])
@l1x
l1x / jmx
Created March 19, 2014 21:40
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl = false
(require '[clojure.java.jmx :as jmx])
(jmx/with-connection {:host "localhost", :port 9999} (jmx/mbean-names "*kafka*:*"))
(jmx/with-connection {:host "localhost", :port 9999}
(jmx/mbean "\"kafka.producer\":type=\"ProducerStats\",name=\"-FailedSendsPerSec\""))
;;{:Count 0, :EventType "failed sends", :RateUnit #< SECONDS>,
;;:MeanRate 0.0, :OneMinuteRate 0.0, :FiveMinuteRate 0.0, :FifteenMinuteRate 0.0}
#sadf -s 07:34:00 | grep iowait
node 594 1395328801 all %iowait 0.17
node 593 1395329402 all %iowait 0.16
node 592 1395330001 all %iowait 0.18
node 594 1395330601 all %iowait 0.12
node 595 1395331201 all %iowait 0.13
node 595 1395331801 all %iowait 0.13
node 595 1395332401 all %iowait 0.17
node 594 1395333001 all %iowait 0.20
node 594 1395333601 all %iowait 0.04