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 / ncsa_stats.awk
Created Jul 30, 2013
A poor man's NCSA log analyzer written in (G)AWK
View ncsa_stats.awk
# My first GAWK script
{
total_bytes += $10
}
$9 ~ /2[0-9]+/ {
n_sc_2xx++
}
@falzm
falzm / gist:6433872
Created Sep 4, 2013
Colorized manpages with less
View gist:6433872
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
@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 / commonlog2iso8601.go
Created Nov 2, 2014
Convert Nginx' "time_local" to "time_iso8601" date formats
View commonlog2iso8601.go
package main
import "fmt"
import "time"
func main() {
commonlogDateFormat := "2/Jan/2006:15:04:05 -0700"
iso8601DateFormat := "2006-01-02T15:04:05-07:00"
parsedDate, err := time.Parse(commonlogDateFormat, "18/Oct/2014:08:53:14 +0200")
@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 / collectd_mariadb_tablestats.py
Last active Apr 13, 2017
collectd-python module for reading MariaDB user statistics
View collectd_mariadb_tablestats.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# collectd-python module for reading MariaDB user statistics
# Author: Marc Falzon
#
# Requirements:
# * MariaDB >= 5.2.0 with user statistics enabled
# (see https://mariadb.com/kb/en/mariadb/user-statistics/)
# * collectd compiled with Python module
@falzm
falzm / riq.go
Created Aug 15, 2015
RIQ - Riemann Index Query
View riq.go
package main
import (
"flag"
"fmt"
"os"
"time"
"github.com/amir/raidman"
)
@falzm
falzm / itunes2json.py
Last active Mar 8, 2020
Convert iTunes exported library to JSON
View itunes2json.py
#!/usr/bin/env python
from __future__ import print_function
from pprint import pprint
import json
import plistlib as plist
import sys
@falzm
falzm / .json
Last active Oct 4, 2015
Top 10 most albums per artist/band
View .json
{
"took" : 32,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 8392,
You can’t perform that action at this time.