Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew Iannucci mpiannucci

View GitHub Profile
View screenshot.json
{
"format": "image/png",
"filename": "fractional-scale-test.png",
"frames": [
{
"maptime": "2020-08-30T12:00:00Z",
"title": "2020-08-30T12:00:00Z",
"overlays": [
{
"type": "tile",
@mpiannucci
mpiannucci / mapdelegate.swift
Last active Apr 6, 2020
BuoyFinder Map Overlays
View mapdelegate.swift
import SwiftUI
import MapKit
import PlaygroundSupport
class SwellDataOverlay : NSObject, MKOverlay {
let coordinate: CLLocationCoordinate2D
let boundingMapRect: MKMapRect
let magnitude: Double
let angle: Double
View reactive_refresh_indicator.dart
// Copyright 2014 The Chromium Authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
@mpiannucci
mpiannucci / wattage.py
Created Nov 3, 2016
Get Battery Power Consumption on Linux
View wattage.py
#!/usr/bin/python
with open('/sys/class/power_supply/BAT0/status') as f:
if 'Charging' in f.read():
print('The battery is currently charging')
exit(0)
scale = 1000000000000.000
voltage = 0
current = 0
@mpiannucci
mpiannucci / buoyspectraplotter.py
Last active Aug 14, 2017
Parse Raw NDBC Directional Wave Spectra
View buoyspectraplotter.py
import urllib.request as request
import json
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cm
import numpy as np
class BuoySpectraPlotter:
def __init__(self, buoy_station):
@mpiannucci
mpiannucci / chart.rs
Created May 25, 2016
Lib UI Rust LineChart
View chart.rs
extern crate ui;
use ui::{Area, AreaDrawParams, AreaHandler};
use ui::draw::{Brush, FillMode, Path, SolidBrush, StrokeParams, LineCap, LineJoin};
use ui::draw::text::{Layout, Font, FontDescriptor, Weight, Italic, Stretch};
pub struct LineChart {
pub title: String,
pub x_axis_label: String,
pub y_axis_label: String,
@mpiannucci
mpiannucci / inspectslice.go
Created Nov 9, 2015
Inspect Go Slice memeory layouts
View inspectslice.go
package main
func InspectSlice(slice []string) {
// Capture the address to the slice structure
address := unsafe.Pointer(&slice)
// Capture the address where the length and cap size is stored
lenAddr := uintptr(address) + uintptr(8)
capAddr := uintptr(address) + uintptr(16)
@mpiannucci
mpiannucci / .vimrc
Last active Nov 21, 2017
Linux Config Files
View .vimrc
" Try to determine type of file from name and contents
filetype plugin indent on
" Enable syntax highligting
syntax on
" Show partial commands on last line
set showcmd
" Highlight searches
@mpiannucci
mpiannucci / vectordoublevalidator.cpp
Last active Jul 17, 2017
A custom implementation of QDoubleValidator to allow comma-seperated numerical values
View vectordoublevalidator.cpp
#include "vectordoublevalidator.h"
// VectorDoubleValidator Constructor
VectorDoubleValidator::VectorDoubleValidator ( double bottom, double top, int decimals,
QObject* parent = 0 )
: QDoubleValidator ( bottom, top, decimals, parent ) {
}
// Custom validate function to allow comma seperated values
@mpiannucci
mpiannucci / Keybindings.sublime-keymap
Last active Nov 21, 2017
Sublime-Text 3 User Settings
View Keybindings.sublime-keymap
[
{ "keys": ["ctrl+q"], "command": "close_file" },
{ "keys": ["ctrl+k", "ctrl+0"], "command": "fold_all" },
]