Skip to content

Instantly share code, notes, and snippets.

@gandrei95
gandrei95 / gist:af5adb2f64fb020e0f4a1b8919d122bd
Created August 27, 2019 12:17 — forked from mikepea/gist:07b1cede92c119e4f297
Grafana Scripted Dashboard example for collectd with SeparateInstances and StoreRates enabled
/* global _ */
/*
* Complex scripted dashboard
* This script generates a dashboard object that Grafana can load. It also takes a number of user
* supplied URL parameters (int ARGS variable)
*
* Global accessable variables
* window, document, $, jQuery, ARGS, moment
*
* Return a dashboard object, or a function
@gandrei95
gandrei95 / oneliners.sh
Last active July 12, 2019 06:52
Useful one-liners
cat /proc/meminfo | grep "^Mem" | awk -F' ' '{gsub(":", ""); printf "%s \t%.2f MB - %.3f GB\n", $1, (($2/1024)), (($2/1024/1024)) }'
MemTotal 15787.78 MB - 15.418 GB
MemFree 186.55 MB - 0.182 GB
MemAvailable 612.25 MB - 0.598 GB
Compute the sum of all elasticsearch indices size
curl -sS 'http://localhost:9200/_cat/indices?bytes=b' | sort -rnk8 | awk '{print (($10/1024/1024/1024))}' | awk 'BEGIN {sum=0} {for (i = 1; i <= NF; i++) sum += $i} END {print sum}'
@gandrei95
gandrei95 / sed cheatsheet
Created April 1, 2019 09:18 — forked from un33k/sed cheatsheet
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@gandrei95
gandrei95 / Private-pypi-howto
Created December 13, 2018 17:51 — forked from Jaza/Private-pypi-howto
Guide for how to create a (minimal) private PyPI repo, just using Apache with directory autoindex, and pip with an extra index URL.
*
@gandrei95
gandrei95 / pfsense-on-oracle-linux-7.md
Created October 3, 2018 08:16 — forked from RulerOf/pfsense-on-oracle-linux-7.md
Installing pfSense on KVM in Enterprise Linux 7

Installing pfSense on KVM in Enterprise Linux 7

We download the latest release of pfSense as a gzipped ISO, then extract it and pass it to virt-install to get the VM up and running. Interactive portions of setup are handled with a VNC viewer because the pfSense installer doesn't seem to be able to work with virt-install's native console redirection, at least not out of the box. I'd love a tip from anyone if it's possible to fix that somehow.

Instructions

Find the latest release here.

Download the gzipped ISO from a mirror into a directory that KVM can access, then unzip it:

@gandrei95
gandrei95 / rounding_decimals.md
Created September 7, 2018 18:24 — forked from jackiekazil/rounding_decimals.md
How do I round to 2 decimals in python?

How do I round to 2 decimals?

In python, you have floats and decimals that can be rounded. If you care about the accuracy of rounding, use decimal type. If you use floats, you will have issues with accuracy.

All the examples use demical types, except for the original value, which is automatically casted as a float.

To set the context of what we are working with, let's start with an original value.

Original Value

@gandrei95
gandrei95 / k8s-pi.md
Created September 6, 2018 14:10 — forked from alexellis/k8s-pi.md
K8s on Raspbian

Kubernetes on (vanilla) Raspbian Lite

Yes - you can create a Kubernetes cluster with Raspberry Pis with the default operating system called Raspbian. This means you can carry on using all the tools and packages you're used to with the officially-supported OS.

This is part of a blog post Serverless Kubernetes home-lab with your Raspberry Pis written by Alex Ellis.

Copyright disclaimer: Please provide a link to the post and give attribution to the author if you plan to use this content in your own materials.

Pre-reqs: