Skip to content

Instantly share code, notes, and snippets.

@LittleWat
LittleWat / notify_azure_cost.py
Last active June 9, 2022 21:17
Notify Azure Cost from AWS Lambd with python
import json
import os
from datetime import datetime
import requests
SLACK_WEBHOOK_URL = os.environ['SLACK_WEBHOOK_URL']
ENV = os.environ['ENV']
SUBSCRIPTION_ID = os.environ["SUBSCRIPTION_ID"]
TENANT = os.environ["TENANT"]
@rsmitty
rsmitty / vsphere.sh
Created January 6, 2022 18:12
A little script to automate creation of talos clusters in vsphere
#!/bin/bash
set -e
## The following commented environment variables should be set
## before running this script
# export GOVC_USERNAME='[email protected]'
# export GOVC_PASSWORD='xxx'
# export GOVC_INSECURE=true
@saiyam1814
saiyam1814 / install.sh
Last active April 14, 2024 17:05
Kubernetes + containerd 1.23 setup for Ubuntu 20.04
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "step1"
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
echo "kubeadm install"
sudo apt update -y
sudo apt -y install vim git curl wget kubelet=1.23.0-00 kubeadm=1.23.0-00 kubectl=1.23.0-00
echo "memory swapoff"
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
sudo swapoff -a
sudo modprobe overlay
#!/bin/bash
############################################################################
## ██╗ ██████╗ █████╗ ███████╗███████╗ ███████╗███████╗██╗ ██╗ ##
## ██║ ██╔══██╗██╔══██╗██╔════╝██╔════╝ ██╔════╝██╔════╝██║ ██║ ##
## ██║ ██████╔╝███████║███████╗███████╗█████╗███████╗███████╗███████║ ##
## ██║ ██╔═══╝ ██╔══██║╚════██║╚════██║╚════╝╚════██║╚════██║██╔══██║ ##
## ███████╗██║ ██║ ██║███████║███████║ ███████║███████║██║ ██║ ##
## ╚══════╝╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ##
############################################################################
## Preparation:

Installing K3s on Raspberry Pi Cluster

Description

This article will document how to deploy K3s to a cluster of Raspberry Pis.

Requirements

I am using the following:

@rajbos
rajbos / Get-JWTToken.ps1
Last active July 8, 2025 11:29
Load jwt token from GitHub App for authentication
# code to load the JWT token in PowerShell
# Call teh Get-JWTToken method with the App ID and the App Private Key (normal string from env var or file contents, make sure there is no extra line ending at the end of it!).
function Build-Payload {
Param (
[string] $app_id
)
$iat = [Math]::Floor([decimal](Get-Date(Get-Date) -UFormat %s))
$payload = @{
"iat" = [int]$iat # issues at = now
# Originally from here : https://gist.github.com/ngaffa/15d46c98dd82620c8120ddf7398d6dbd
#cloud-config
package_update: true
package_upgrade: true
packages:
# Update the apt package index and install packages needed to use the Docker and Kubernetes apt repositories over HTTPS
- apt-transport-https
- ca-certificates
- curl
const express = require('express'); // Adding Express
const app = express(); // Initializing Express
const puppeteer = require('puppeteer'); // Adding Puppeteer, Run `apt-get install chromium` first (on Debian)
// Wrapping the Puppeteer browser logic in a GET request
app.get('/', function (req, res) {
// Launching the Puppeteer controlled headless browser and navigate to the Digimon website
puppeteer.launch({
headless: true,
@mbenford
mbenford / dbus-monitor.py
Created June 13, 2021 22:37
Monitoring DBus with dbus-next
from dbus_next.aio import MessageBus
from dbus_next.message import Message
from dbus_next.constants import BusType
import asyncio
async def main():
match = (
"type='method_call',"
"interface='org.freedesktop.PowerManagement.Inhibit',"
"path='/org/freedesktop/PowerManagement/Inhibit'"
@hwinkelmann
hwinkelmann / liontron.js
Last active March 17, 2025 11:55
Read data from a LIONTRON battery
// This is a POC that reads data from a Jiabaida BMS, as it is integrated
// in the Liontron battery that I have.
// It's basically the same information as it is displayed in the buggy app that
// comes with it.
const {createBluetooth} = require('node-ble')
const {bluetooth, destroy} = createBluetooth()
// BLE adress of the battery - this will be different from battery to battery
const DEVICE_ADRESS = "A4:C1:38:C5:96:C9";