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
ls /proc | egrep "[0-9]+" | while read X; do echo $X $(cat $X/status | grep ^VmSwap); done | grep VmSwap | sort -n -k 3 |
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
[ | |
{ | |
"_id": "628e63c0-c7ce-11e9-9c54-8d74d8e24aa6", | |
"_type": "visualization", | |
"_source": { | |
"title": "Count percentiles", | |
"visState": "{\n \"title\": \"Count percentiles\",\n \"type\": \"histogram\",\n \"params\": {\n \"addLegend\": true,\n \"addTimeMarker\": false,\n \"addTooltip\": true,\n \"categoryAxes\": [\n {\n \"id\": \"CategoryAxis-1\",\n \"labels\": {\n \"show\": true,\n \"truncate\": 100\n },\n \"position\": \"bottom\",\n \"scale\": {\n \"type\": \"linear\"\n },\n \"show\": true,\n \"style\": {},\n \"title\": {},\n \"type\": \"category\"\n }\n ],\n \"grid\": {\n \"categoryLines\": false,\n \"style\": {\n \"color\": \"#eee\"\n }\n },\n \"legendPosition\": \"right\",\n \"seriesParams\": [\n {\n \"data\": {\n \"id\": \"1\",\n \"label\": \"Percentiles of nginx.access.request_time\"\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 find-thread-by-id [thread-id] | |
(let [ts (make-array Thread 1000)] | |
(-> (Thread/currentThread) .getThreadGroup .getParent (.enumerate ts)) | |
(->> ts | |
(filter (comp not nil?)) | |
(filter #(= thread-id (.getId %))) | |
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
REGEDIT4 | |
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] | |
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,01,00,3a,00,00,00,00,00 |
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
#!/usr/bin/env bash | |
# Usage: make_event my-event test "hello world" -> {"name":"my-event","test":"hello world","unixtime":123} | |
make_event() { | |
if ! (( "$#" % 2)); then | |
echo "log_event expects an uneven number of arguments" | |
echo "Usage: $0 <event-name> [[<key> <val>]...]" | |
exit 1 | |
fi |
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
(start-server (fn [] | |
[(LoggingHandler. "proxy" LogLevel/INFO) | |
(proxy-handler "www.freekpaans.nl" 80) |
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
# Adapted from https://calomel.org/zfs_health_check_script.html | |
UserParameter=zpool.health[*],zpool list $1 | grep ONLINE | wc -l | |
UserParameter=zpool.error-free[*],zpool status $1 | grep ONLINE | grep -v " state" | awk '$$3==0 && $$4==0 && $$5==0 {print}' | wc -l |
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
<?php | |
//double submit cookies (https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet#Double_Submit_Cookies) CSRF protection | |
define(__CSRF_TOKEN_COOKIE_NAME,"__csrf_token"); | |
define(__CSRF_TOKEN_INPUT_NAME, "__csrf_token"); | |
function generate_csrf_token() { | |
//from http://stackoverflow.com/a/31683058/345910 | |
$token=base64_encode(openssl_random_pseudo_bytes(32)); |
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 layered-example.application-service-test | |
(:require [layered-example.data.test-helpers :as test-helpers] | |
[clojure.test :refer :all] | |
[layered-example.application-service :as app-svc] | |
[layered-example.domain.cargo.cargo-repository :as cargo-repository] | |
[layered-example.data.mysql-cargo-repository :as mysql-cargo-repository])) | |
(def db-spec (test-helpers/default-db-spec)) | |
(def the-cargo-repo (mysql-cargo-repository/new-cargo-repository db-spec)) |
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 layered-example.application-service | |
(:require [layered-example.domain.cargo.cargo :as cargo] | |
[layered-example.domain.cargo.cargo-repository :as cargo-repository])) | |
(defn create-new-cargo! [& args ] | |
(let [new-cargo (apply cargo/create-new-cargo args)] | |
(cargo-repository/add! new-cargo))) | |
(defn book-onto-voyage! [cargo-id & args] | |
(let [{:keys [version cargo] :as result} (cargo-repository/find cargo-id) |
NewerOlder