Skip to content

Instantly share code, notes, and snippets.

@oxmix
oxmix / mini-chart.js
Created October 18, 2023 22:49
Mini Chart in SVG Area Curve
const width = 300
const height = 50
const graph = [1, 2, 5, 0, 5, 0.2, 0.3, 0.4, 3, 9]
const peakVal = Math.max(...graph)
graph.unshift(0) // dot start
graph.push(0) // dot end
const part = width / (graph.length - 1)
const points = []
for (const i in graph) {
@oxmix
oxmix / clean-registry.bash
Created June 8, 2023 08:40
Cleaner docker registry by only tag latest
#!/usr/bin/env bash
set -e
data="$(dirname "$0")/registry/data"
reg="$data/docker/registry/v2/repositories"
for n1 in $(ls $reg -t); do
for n2 in $(ls $reg/$n1 -t); do
repo=$n1/$n2
tag=$reg/$repo/_manifests/tags/latest/index/sha256
@oxmix
oxmix / sensors.c
Created January 4, 2023 03:11
ESP8266 sensors BME280 and TEMT6000
const char* ssid = "nameWife";
const char* password = "passWifi";
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <Wire.h>
#include <Adafruit_BME280.h>
#include <Adafruit_Sensor.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoJson.h>
@oxmix
oxmix / swap.bash
Created July 20, 2022 14:17
Who uses swap
#!/usr/bin/env bash
SUM=0
OVERALL=0
for DIR in `find /proc/ -maxdepth 1 -type d -regex "^/proc/[0-9]+"`
do
PID=`echo $DIR | cut -d / -f 3`
PROGNAME=`ps -p $PID -o comm --no-headers`
for SWAP in `grep VmSwap $DIR/status 2>/dev/null | awk '{ print $2 }'`
do