Skip to content

Instantly share code, notes, and snippets.

@Elektordi
Elektordi / saml-decode.sh
Last active April 11, 2024 12:05
Decode SAML payload from command line
#!/bin/sh
token="$1"
if [ -z "$token" ]; then
read token
fi
echo $token | sed -e "s/-/+/" -e "s/_/\//" | base64 -d | xmllint --format --recover -
echo
@MadmanMonty
MadmanMonty / ESP32 CAM setup
Created April 2, 2021 08:51
ESP32 CAM Tasmota Template, with LED1 and Light configuration. The default on the tasmota website incorrectly defines these, preventing activation of the light.
{"NAME":"AITHINKER CAM inc LEDs","GPIO":[4992,1,1,1,416,5088,1,1,1,1,1,1,1,1,5089,5090,0,5091,5184,5152,0,5120,5024,5056,0,0,0,0,4928,320,5094,5095,5092,0,0,5093],"FLAG":0,"BASE":1}
@Elektordi
Elektordi / jwt-decode.sh
Last active July 31, 2023 13:51
Decode jwt from command line
#!/bin/sh
token="$1"
if [ -z "$token" ]; then
read token
fi
echo $token | jq -R 'gsub("-";"+") | gsub("_";"/") | split(".") | select(length > 0) | .[0],.[1] | @base64d | fromjson'
echo
@mik-laj
mik-laj / convert.py
Last active February 1, 2025 22:59
Helm-unittest to Python unittest migration script. Part of: https://github.com/apache/airflow/pull/11827
import codecs
import re
from os import listdir
from os.path import isfile, join, dirname, abspath, basename
from typing import Any, Optional, Set, Dict
import sys
import black
from jinja2 import Template
import jinja2
const fs = require('fs');
const replace = [
// fix spaces after @, # and ()
[/@ %s/g, '@%s'],
[/@% s/g, '@%s'],
[/`@ %s '/g, '`%s`'],
[/"@ %s/g, '"@%s'],
#!/bin/bash
# Adjust homserver, room, and accesstoken to your particular setup
# Script is expecting data to be piped in on STDIN
# Example:
# echo "some text" | sendmatrix
msgtype=m.text
homeserver=<homeserver>
room=<room id>
@ernetas
ernetas / telegraf-xen
Last active January 19, 2021 07:20
Telegraf Xen exec monitoring script
#!/usr/bin/env python3
import socket
hostname = socket.gethostname()
import subprocess
import time
def print_influx_data(xendomain, item, value):
global timestamp
print('xen_' + item + ',domain=' + xendomain + ',host=' + hostname + ' ' + value + ' ' + timestamp)
@teroka
teroka / dell_specs.py
Created November 8, 2014 19:23
Dell API: Original Config for Hardware
#!/usr/bin/env python
# Script to query Dell's API for the hardware's original config.
# Just drop your service tag as parameters for the script and go.
import sys
import requests
APIKEY = 'd676cf6e1e0ceb8fd14e8cb69acd812d'
URL = 'https://api.dell.com/support/v2/assetinfo/detail/tags.json?svctags={0}&apikey=' + APIKEY
@mqu
mqu / usb-auto-backup
Last active October 3, 2023 14:43
usb-auto-backup script - a script connected to UDEV daemon, running rsync backup when user insert USB drive.
TODO :
- manage user notification ; notify-send not really working ; current alternative either.
- display hostid used to customize usb backup script.
INSTALL
- copy usb-auto-backup script to /usr/local/bin,
- create an partition on an USB drive named "backup" ; get id (/dev/sddX) -> will be needed in udev.rules
- identity your drive information for UDEV-rules using : udevadm info -a -p $(udevadm info -q path -n /dev/sdXX)
- create an UDEV rule : /etc/udev/rules.d/99-usb-auto-backup.rules like this one :
@2xyo
2xyo / python-install-2.7.5.sh
Last active August 13, 2017 09:38
Python 2.7.5 from source + virtualenv with Debian GNU/Linux 6.0.7 (squeeze)
#!/usr/bin/env bash
cd /tmp
# Install dependencies
aptitude -y install build-essential python-pip libmysqlclient-dev libadns1-dev \
python-dev libreadline-dev libgdbm-dev zlib1g-dev libsqlite3-dev \
libssl-dev libbz2-dev libncurses5-dev libdb-dev
# Download latest version