Skip to content

Instantly share code, notes, and snippets.

@marcobazzani
marcobazzani / papertrail_ds.py
Created May 31, 2024 07:40
Athena and PaperTrail Datasource
import os
import boto3
import time
from datetime import datetime
import urllib.request
import json
def round_minute(date: datetime = None, round_to: int = 1):
@marcobazzani
marcobazzani / procmon.py
Last active December 21, 2021 08:53 — forked from saaj/HISTORY.rst
Simple CPU and RSS monitor that pushes to statsd
import sys
import re
import time
import argparse
import logging
import psutil
import statsd
import requests
import os
@marcobazzani
marcobazzani / formatsso.js
Last active April 27, 2022 14:03 — forked from martinlindenberg/format-aws-sso.js
reformats AWS sso page. (greasemonkey script)
// ==UserScript==
// @name aws-format-sso
// @namespace signin.aws.amazon.com
// @description reformats that page
// @include https://signin.aws.amazon.com/saml
// @version 1.2
// @grant none
// ==/UserScript==
$('#saml_form').css('max-width', '500px');
$('fieldset').css('width', '500px');
#!/bin/bash
set -e -u
FILE=$1
NAME=$(echo "$FILE" | sed 's/\.[^.]*$//')
EXTENSION=$(echo "$FILE" | sed 's/^.*\.//')
rm -rf $NAME
rm -rf $NAME.zip
#!/bin/bash
curl 'https://172.16.0.223:8443/api/login' --data '{"username":"admin","password":"password"}' --compressed --insecure -c cookies.txt -b cookies.txt -sS |jq .
curl 'https://172.16.0.223:8443/api/s/default/cmd/devmgr' --data-binary '{"cmd":"speedtest"}' --compressed --insecure -c cookies.txt -b cookies.txt -sS | jq .
### put the 3 files anywhere in and run as /path/to/files/merge BRANCH
#!/bin/sh
#findup
pwd="`pwd`"
start="$pwd"
while [ ! "$pwd" -ef .. ]; do
[ -e "$1" ] && echo -n "$pwd" && exit
cd .. || exit 1
pwd="`pwd`"
@marcobazzani
marcobazzani / speedmeter.sh
Last active August 18, 2017 17:33
rx speed all networks
#!/usr/bin/env bash
for a in `ls -1 /sys/class/net/`
do
declare pre_${a}_rxbytes=`cat /sys/class/net/$a/statistics/rx_bytes`
declare pre_${a}_txbytes=`cat /sys/class/net/$a/statistics/tx_bytes`
done
while true