Skip to content

Instantly share code, notes, and snippets.

#include <stdlib.h>
#include <stdio.h>
#include <x86intrin.h>
int main(int argc, char** argv) {
__v16si a = {1,2,3,4,5,6,7,8,0,0,0,0,0,0,0,0};
__v16si b = {9,10,11,12,13,14,15,16,1,1,1,1,1,1,1,1};
__v16si c;
c = a+b;
;; Set up slime-js
;;
;; To install, see https://github.com/swank-js/swank-js/wiki/Installation
;;
;; This is what I did:
;;
;; npm install swank-js -g
;; M-x package-install slime-js
;;
;; The slime-js version in marmalade requires swank 2010.04.04, or at least
[{:url "http://www.yahoo.com/"
:interval 1000 ;; optional
:validator #(re-find #"yahoo" %) ;; optional
:http-options {:timeout 2000 ;; :http-options itself is also optional
:user-agent "Mozilla"}
:graphite-ns "com.yahoo.www" ;; defualt to reverse domain name
:params-fn (map #(hash-map :id %) (iterate inc 0)) ;; programatically control query params
:riemann-tags ["Yahoo" "Homepage"]
}
{:url "http://www.google.com/?search=abc"
(moving-time-window 600
(overshoot-by-ratio 1000 0.5
#(info %)
(email "[email protected]")))
(defn overshoot-by-ratio
"Takes a list of event, emit an event if the overshoot events is over the ratio.
The emitted event will contain a description of the overshoot threshold and the ratio;
the metric of the emitted event will be the median of overshoot events. Example:
(moving-time-window 300 ; 5 min
(overshoot-by-ratio 1500 0.2 ; if the ratio of metrics which more than 1500
; is larger than 0.2, the below would be called
(throttle 1 500
(email \"[email protected]\"))))"
(defn my-awesome-function [arg1 arg2 &amp; children]
(fn [event]
; process event with arg1, arg2, and generate my-modified-event
(call-rescue my-modified-event children)))
(stream
(while (> metric 2000)
(fn [event] (info "Event metric is larger than 2000! event:" event))))
(stream
(moving-time-window 600 ; 600 sec = 10 min
(folds/mean
(graphite))
(folds/median
(while (> metric 1000)
(email "[email protected]")))))
@dryman
dryman / riemann.config.clj
Last active December 22, 2015 05:49
Robust overshoot detection function for riemann
(defn overshoot-by-ratio
"Takes a list of event, emit an event if the overshoot events is over the ratio.
The emitted event will contain a description of the overshoot threshold and the ratio;
the metric of the emitted event will be the median of overshoot events. Example:
(moving-time-window 300 ; 5 min
(overshoot-by-ratio 1500 0.2 ; if the ratio of metrics which more than 1500
; is larger than 0.2, the below would be called
(throttle 1 500
(email \"[email protected]\"))))"
(defun wordnet (word)
"Check word definition from WordNet command line program"
(interactive
(list (read-string "Check for word: "
(apply 'buffer-substring
(let (bounds)
(if (use-region-p)
(setq bounds (cons (region-beginning) (region-end)))
(setq bounds (bounds-of-thing-at-point 'word)))
(list (car bounds) (cdr bounds)))))))