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:44
Longest track duration
{
"took" : 7,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 8392,
@falzm
falzm / .json
Last active October 4, 2015 13:43
Shortest track duration
{
"took" : 8,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 8392,
@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 / .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 / itunes2json.py
Last active March 8, 2020 17:09
Convert iTunes exported library to JSON
#!/usr/bin/env python
from __future__ import print_function
from pprint import pprint
import json
import plistlib as plist
import sys
@falzm
falzm / riq.go
Created August 15, 2015 10:01
RIQ - Riemann Index Query
package main
import (
"flag"
"fmt"
"os"
"time"
"github.com/amir/raidman"
)
@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 / online_rpn.py
Created June 16, 2015 15:05
List Online.net RPN groups
#!/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 / gist:0e005af9adaebacf9586
Last active August 29, 2015 14:15
Gory hack to download a GPG key from a keyserver in HTTP
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 / 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")