Skip to content

Instantly share code, notes, and snippets.

Avatar

Heinrich Hartmann HeinrichHartmann

View GitHub Profile
View Monitoring Gloassary.md

Glossary of Monitoring

  • A system is a set of connected components

The definition of connected and components is missing. I think we can go with definitions like:

  • A components is a set of processes (in the OS sense)
  • Two components are connected if they can talk to each other (over a network or IPC).

Example: A LAMP system, consists of components:

@HeinrichHartmann
HeinrichHartmann / pinbuffer.el
Created Jun 15, 2016
Pin an buffer to a window in #emacs
View pinbuffer.el
;; Similar to: http://stackoverflow.com/questions/43765/pin-emacs-buffers-to-windows-for-cscope/65992#65992
(defun pin-buffer ()
"Pin buffer to current window."
(interactive)
(message
(if (let (window (get-buffer-window (current-buffer)))
(set-window-dedicated-p window (not (window-dedicated-p window))))
"pinned buffer" "un-pinned buffer")
))
@HeinrichHartmann
HeinrichHartmann / histogram.py
Created Jan 15, 2016
Simple (inefficient) example of how to create a histogram with python
View histogram.py
from matplotlib import pyplot as plt
import numpy as np
X = np.genfromtxt("DataSets/RequestRates.csv", delimiter=",")[:,1]
bins = [500, 700, 800, 900, 1000, 1500, 1800, 2000, 2200]
bin_count = len(bins) - 1
sample_counts = [0] * bin_count
for x in X:
for i in range(bin_count):
if (bins[i] <= x) and (x < bins[i + 1]):
sample_counts[i] += 1
@HeinrichHartmann
HeinrichHartmann / GoogleSheetsExample.py
Last active Dec 5, 2016
Convenient Access to Google Spreadsheets
View GoogleSheetsExample.py
# Copyright (c) 2015 Heinrich Hartmann
# MIT License http://choosealicense.com/licenses/mit/
import gdata.spreadsheet.service
class GoogleDriveConnection(object):
def __init__(self, email, password):
self.client = gdata.spreadsheet.service.SpreadsheetsService()
self.client.ClientLogin(email, password)
@HeinrichHartmann
HeinrichHartmann / _G.lua
Last active Aug 29, 2015
Lua Global Environment
View _G.lua
{
_G = nil --[[ref]],
_VERSION = "Lua 5.1",
arg = {
[-1] = "/usr/bin/lua",
[0] = "main.lua"
} --[[table: 0xbcbef0]],
assert = assert --[[function: 0xbc5310]],
collectgarbage = collectgarbage --[[function: 0xbc5370]],
coroutine = {
@HeinrichHartmann
HeinrichHartmann / sensor-server.py
Last active Aug 29, 2015
RaspberryPi Serving Sensor Data over HTTP
View sensor-server.py
#!/usr/bin/env python
# Import the ADC driver:
# https://gist.github.com/HeinrichHartmann/27f33798d12317575c6c
import ADC0832 as ADC
import sys
import BaseHTTPServer
import json
from BaseHTTPServer import BaseHTTPRequestHandler
@HeinrichHartmann
HeinrichHartmann / RPi_ADC8032.py
Created Dec 14, 2014
Raspbery Pi Analog Input with ADC0832
View RPi_ADC8032.py
#!/usr/bin/env python
#
# Analog Input with ADC0832 chip
#
# Datasheet: http://www.ti.com/lit/ds/symlink/adc0838-n.pdf
# Part of SunFounder LCD StarterKit
# http://www.sunfounder.com/index.php?c=show&id=21&model=LCD%20Starter%20Kit
#
import time
@HeinrichHartmann
HeinrichHartmann / TimeSeriesTools.py
Last active Aug 29, 2015
TimeSeries convenience functions
View TimeSeriesTools.py
import numpy as np
import matplotlib.pylab as plt
from scipy import stats
from collections import *
from itertools import *
#
# Convenience Class for Time Series
#
# Series Objects can be added and subtracted using infix operators.
@HeinrichHartmann
HeinrichHartmann / blink.py
Last active Aug 29, 2015
Raspberry PI GPIO Tester
View blink.py
View hartmann.pub
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.1.4
Comment: Hostname: pgp.mit.edu
mQENBFLOhGwBCADLreJzn4F8bKodTjg/QY4AyvQQWxnM0h56xsUmqTZqvRCp9kgtrcR5Bnvp
kMMRoIx9rOM7Hnp/LrxogZ8ZHbp+r3eQt3tp8p7ZwymQCT8cZoreTQplDp4eqZmnPh4BMk3a
+gqvgPv5SShwQjNGtf8r31MWe+xTCx6Db1XYpHav0pSs06Gmf/Kh/WVMtTvh841R0OU9mWhk
OxnOYWDErPSzUolA9u4A20B3LVpowjoA5Oaq3kIzC+mgL7muXhiEA4hzL9WXqcDHPXyRS3ut
Djmz1oqXFIZFgwhUUDW6g1hyuVuulNZRMkFtqASi13x+qMF8PwbU6KvoVCXG9++yQF13ABEB
AAG0K0hlaW5yaWNoIEhhcnRtYW5uIDxoYXJ0bWFubkB1bmkta29ibGVuei5kZT6JAT4EEwEC