Skip to content

Instantly share code, notes, and snippets.

View jsharkey13's full-sized avatar

James Sharkey jsharkey13

View GitHub Profile
@jsharkey13
jsharkey13 / zpool_iostat_latency_graphs.py
Created January 18, 2024 11:37
Analyse zpool disk latencies with graphical output.
# zpool disk latency visualisation
#
# This script parses the output of the zpool stats command:
# zpool iostat -pvwH
# which provides per-disk latency information for reads and writes.
#
# Run the command:
#
# zpool iostat -pvwH > output.tsv
#
@jsharkey13
jsharkey13 / hexagon_svg_points.js
Created March 30, 2020 13:06
Generate the points for a hexagon in an SVG image
// See https://stackoverflow.com/questions/52172067/create-svg-hexagon-points-with-only-only-a-length
const round_4dp = function(x) {return Math.round(x*10000)/10000};
const radius = 125;
const height = 260;
const width = 220;
const points = [0, 1, 2, 3, 4, 5, 6].map((n, i) => {
var angle_deg = 60 * i - 30;
var angle_rad = Math.PI / 180 * angle_deg;
return [round_4dp(width/2 + radius * Math.cos(angle_rad)), round_4dp(height/2 + radius * Math.sin(angle_rad))];
@jsharkey13
jsharkey13 / facebook_analysis_demo.py
Last active February 2, 2021 17:11
Facebook Parser (Python 3) (2018-09-09)
# Copyright (c) 2018 James Sharkey (https://github.com/jsharkey13/facebook_message_parser)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
@jsharkey13
jsharkey13 / fibonacci.py
Last active November 9, 2015 16:33
Silly Ways to find the Nth Fibonacci Number
import math
import time
PHI = (1.0 + math.sqrt(5))/2.0
def fibonacci_for(N):
for_loop = [0]
def fib(N):