Skip to content

Instantly share code, notes, and snippets.

View falzm's full-sized avatar
🙃

Marc Falzon falzm

🙃
View GitHub Profile
@falzm
falzm / .json
Last active October 4, 2015 13:46
Top 10 most albums per artist/band
{
"took" : 32,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 8392,
@falzm
falzm / ncsa_stats.awk
Created July 30, 2013 20:44
A poor man's NCSA log analyzer written in (G)AWK
# My first GAWK script
{
total_bytes += $10
}
$9 ~ /2[0-9]+/ {
n_sc_2xx++
}
@falzm
falzm / gist:6433872
Created September 4, 2013 07:44
Colorized manpages with less
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 / collectd_mariadb_tablestats.py
Last active April 13, 2017 14:41
collectd-python module for reading MariaDB user statistics
#!/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 / commonlog2iso8601.go
Created November 2, 2014 16:42
Convert Nginx' "time_local" to "time_iso8601" date formats
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 / .json
Created October 3, 2015 18:46
10 Most played tracks
{
"took" : 16,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 8486,
@falzm
falzm / tf_targeted_destroy_bug.tf
Created May 7, 2019 09:20
Terraform sample configuration illustrating a bug with targeted "destroy" command
# This example uses the Exoscale provider:
# https://github.com/exoscale/terraform-provider-exoscale/
locals {
zone = "ch-gva-2"
key_pair = "default"
hostnames = [
"ch2771-test1",
"ch2771-test2",
@falzm
falzm / untag.go
Created May 18, 2019 08:27
Strip all ID3 tags from an MP3 file
package main
import (
"os"
"github.com/bogem/id3v2"
)
func main() {
tag, err := id3v2.Open(os.Args[1], id3v2.Options{Parse: true})
package main
import (
"log"
"net"
"os"
"time"
)
var (
package main
import (
"bufio"
"bytes"
"fmt"
"net/http"
"net/http/httputil"
"os"
)