Skip to content

Instantly share code, notes, and snippets.

@felixhageloh
felixhageloh / top-cpu.jsx
Created May 25, 2016 07:21
Example widget using the new JS + virtual DOM syntax
export const refreshFrequency = 1000;
export const command = `ps axro \"%cpu,ucomm,pid\" \
| sed -e 's/^[ \\t]*//g' -e 's/\\([0-9][0-9]*\\.[0-9][0-9]*\\)\\ /\\1\\%\\,/g' -e 's/\\ \\ *\\([0-9][0-9]*$\\)/\\,\\1/g' -e's/\\ \\ */\\_/g' \
| awk 'FNR>1' \
| head -n 3 \
| awk -F',' '{ printf \"%s,%s,%d\\n\", $1, $2, $3}' \
| sed -e 's/\\_/\\ /g'`;
const style = {
@felixhageloh
felixhageloh / Acrobat.png
Last active January 3, 2017 15:16
Preview vs Acrobat Reader
Acrobat.png
@felixhageloh
felixhageloh / SensorWidget.jsx
Created November 9, 2018 08:02
A widget displaying co2 levels and current temperature from a home-brew sensor
import { css, run } from "uebersicht";
export const refreshFrequency = 5000;
export const command = dispatch => {
run("curl -s sentir1.local/co2").then(output =>
dispatch({ type: "CO2_FETCHED", output })
);
run("curl -s sentir1.local/temp").then(output =>
dispatch({ type: "TEMP_FETCHED", output })
);