Skip to content

Instantly share code, notes, and snippets.

View anonymouse64's full-sized avatar
๐ŸŽ
Think Different

Ian Johnson anonymouse64

๐ŸŽ
Think Different
View GitHub Profile
// split a file path into all the elements of the path
func filePathElements(f string) []string {
paths := make([]string, 0)
fTemp := f
lastElem := ""
for fTemp != "" && fTemp != "/" {
fTemp, lastElem = filepath.Split(filepath.Clean(fTemp))
paths = append([]string{lastElem}, paths...)
}
return paths
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@anonymouse64
anonymouse64 / unmarshaller-for-trevor.go
Last active March 8, 2019 05:54
how to unmarshal a custom type in go
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"github.com/jinzhu/copier"
)
@anonymouse64
anonymouse64 / dashboard.js
Created April 17, 2018 15:48
EdgeXFoundry Grafana Device-Virtual dashboard
{
"__inputs": [
{
"name": "DS_EDGEX_INFLUX DATABASE",
"label": "EdgeX Influx database",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}
@anonymouse64
anonymouse64 / mk_usb_swap.sh
Last active April 13, 2018 14:06
How to add usb drive as swap on Ubuntu Core using systemd
# get the usb device's id/info (for me this was /dev/sda1)
sudo blkid
# unmount it if it's currently mounted
sudo umount /dev/sda1
# make the device into swap space
##################################################################################
#### CAUTION THIS WILL ERASE EVERYTHING ON THE DRIVE #######################
#### PLEASE ENSURE THIS IS THE CORRECT DRIVE AND THERE'S #######################
#### NOTHING OF VALUE ON THE USB DRIVE #######################
##################################################################################