Skip to content

Instantly share code, notes, and snippets.

@baldowl
baldowl / RGB_LED.yaml
Last active July 30, 2025 11:20
Playing with ESP32-C6 and ESPHome
light:
- platform: esp32_rmt_led_strip
name: Status LED
pin: GPIO8
rgb_order: RGB
num_leds: 1
rmt_channel: 0
chipset: ws2812
entity_category: config
@groupsky
groupsky / noark-ex9em.js
Last active January 21, 2022 18:42
ModBus read for Noark Ex9EM 1P 1M 80A MO MT
#!/usr/bin/env node
/*
* ModBus read for Noark Ex9EM 1P 1M 80A MO MT Electric Meter
* https://www.noark.com.hr/en/products/107281
*/
////////////////
// CONFIGURATION
////////////////
@max-rocket-internet
max-rocket-internet / prom-k8s-request-limits.md
Last active October 13, 2025 11:32
How to display Kubernetes request and limit in Grafana / Prometheus properly

CPU: percentage of limit

A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.

This is specific to k8s and containers that have CPU limits set.

To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:

sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
@kytulendu
kytulendu / install-opencl-amd.sh
Last active August 12, 2025 01:32
A shell script to install AMDGPU-PRO OpenCL driver.
#!/bin/bash
# This script will install AMDGPU-PRO OpenCL and Vulkan support.
#
# For Ubuntu and it's flavor, just install the package using this command
# in extracted driver directory instread.
#
# ./amdgpu-pro-install --opencl=legacy,pal --headless --no-dkms
#
# For Arch Linux or Manjaro, use the opencl-amd or rocm-opencl-runtime on AUR instread.
@etiennetremel
etiennetremel / README.md
Last active October 26, 2025 14:09
Simple Wireguard setup as VPN server and multiple clients

Simple WireGuard configuration

1 server, 2 clients

Getting started

Install Wireguard on all machines.

Generate all keys

@mipearson
mipearson / elk.rb
Created July 5, 2018 06:07
Structured Logging with Rails & ELK example files
# Copyright 2018 Marketplacer. MIT License.
require 'json'
require 'active_support/core_ext/class/attribute'
require 'active_support/log_subscriber'
module Elk
class RequestLogSubscriber < ActiveSupport::LogSubscriber
PAYLOAD_KEYS_TO_COPY = %i{
controller
@fredbenenson
fredbenenson / kickstarter_sql_style_guide.md
Last active October 14, 2025 15:32
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose

@apolloclark
apolloclark / postgres cheatsheet.md
Last active October 31, 2025 06:15
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@nitaku
nitaku / README.md
Last active August 4, 2025 01:28
Minimal JSON HTTP server in python

A minimal HTTP server in python. It sends a JSON Hello World for GET requests, and echoes back JSON for POST requests.

python server.py 8009
Starting httpd on port 8009...
curl http://localhost:8009
{"received": "ok", "hello": "world"}
@Kartones
Kartones / postgres-cheatsheet.md
Last active October 28, 2025 17:42
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)