Skip to content

Instantly share code, notes, and snippets.

💭
¯\_(ツ)_/¯

Marc Falzon falzm

💭
¯\_(ツ)_/¯
Block or report user

Report or block falzm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@falzm
falzm / aphyr_clojure_seq.clj
Last active Aug 29, 2015
Some Clojure exercise
View aphyr_clojure_seq.clj
;;; Solutions to http://aphyr.com/posts/304-clojure-from-the-ground-up-sequences problems
; 1. Write a function to find out if a string is a palindrome–that is, if it looks the same forwards and backwards.
(defn palindrome?
"Find out if the string is a palindrome"
[s]
(=
s
(apply str (reverse s))))
View collectd.clj
; Expire old events from the index every 5 seconds.
(periodically-expire 600)
(def graph (graphite {:host "127.0.0.1"}))
; Keep events in the index for 5 minutes by default.
(let [index (default :ttl 300 (update-index (index)))]
; Inbound events will be passed to these streams:
(streams
@falzm
falzm / gist:259aa4a303ec63e77efc
Created Jul 13, 2014
Testing standalone "_getPercentile()" Graphite function
View gist:259aa4a303ec63e77efc
#!/usr/bin/env python
# From https://github.com/graphite-project/graphite-web/blob/master/webapp/graphite/render/functions.py
import math
stats = [43.0, 54.0, 56.0, 61.0, 62.0, 66.0, 68.0, 69.0, 69.0, 70.0, 71.0,
72.0, 77.0, 78.0, 79.0, 85.0, 87.0, 88.0, 89.0, 93.0, 95.0, 96.0,
98.0, 99.0, 99.0]
@falzm
falzm / gist:52b3e66c149b9ba6fb58
Created Jul 13, 2014
Go percentile calculation implementation
View gist:52b3e66c149b9ba6fb58
package main
import (
"fmt"
"math"
"sort"
)
var s = []float64{
43.0, 54.0, 56.0, 61.0, 62.0, 66.0, 68.0, 69.0, 69.0, 70.0, 71.0,
@falzm
falzm / gist:b52c5ca32602e0779a2d
Created Jul 13, 2014
Go percentile calculation implementation from go-metrics
View gist:b52c5ca32602e0779a2d
// From https://github.com/rcrowley/go-metrics/blob/master/sample.go
package main
import (
"fmt"
"math"
"sort"
)
@falzm
falzm / commonlog2json.go
Last active Aug 29, 2015
Quick'n dirty HTTP combined access log JSON formatter
View commonlog2json.go
package main
import (
"bufio"
"fmt"
"os"
"regexp"
)
func main() {
@falzm
falzm / gist:5865546c0e7d1ca425e0
Last active Aug 29, 2015
Vim shortcut: move current line up/down
View gist:5865546c0e7d1ca425e0
" Variation of https://coderwall.com/p/0cn9tq/move-lines-in-vim-like-phpstorm
" <shift> + <up> moves the current line up
" <shift> + <down> moves the current line down
nnoremap <silent> <S-up> ddkP<CR>k
nnoremap <silent> <S-down> ddp<CR>k
@falzm
falzm / gist:0e005af9adaebacf9586
Last active Aug 29, 2015
Gory hack to download a GPG key from a keyserver in HTTP
View gist:0e005af9adaebacf9586
curl -s 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xD8576A8BA88D21E9' | sed -n '/-----BEGIN PGP PUBLIC KEY BLOCK-----/,/-----END PGP PUBLIC KEY BLOCK-----/p'
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.1.4
Comment: Hostname: keyserver.ubuntu.com
mQENBFIOqEUBCADsvqwefcPPQArws9jHF1PaqhXxkaXzeE5uHHtefdoRxQdjoGokHFmHWtCd
9zR7hDpHE7Q4dwJtSFWZAM3zaUtlvRAgvMmfLm08NW9QQn0CP5khjjF1cgckhjmzQAzpEHO5
jiSwl0ZU8ouJrLDgmbhT6knB1XW5/VmeECqKRyhlEK0zRz1aXV+4EVDySlORmFyqlmdIUmiU
1/6pKEXyRBBVCHNsbnpZOOzgNhfMz8VE8Hxq7Oh81qFaFXjNGCrNZ6xr/DI+iXlsZ8urlZjk
e5llm4874N8VPUeFQ/szmsbSqmCnbd15LLtrpvpSMeyRG+LoTYvyTG9QtAuewL9EKJPfABEB
@falzm
falzm / online_rpn.py
Created Jun 16, 2015
List Online.net RPN groups
View online_rpn.py
#!/usr/bin/env python
import re
import httplib
import json
import sys
def query_api(uri):
conn = httplib.HTTPSConnection('api.online.net')
conn.request('GET',
@falzm
falzm / libbeat-output-riemann.go
Created Jul 31, 2015
libbeat-output-riemann.go
View libbeat-output-riemann.go
package riemann
import (
"fmt"
"net"
"reflect"
"strconv"
"time"
"github.com/elastic/libbeat/common"
You can’t perform that action at this time.