Skip to content

Instantly share code, notes, and snippets.

@dadatuputi
dadatuputi / pct-update.sh
Last active January 6, 2022 00:24
Update all Proxmox containers
#!/bin/bash
# update all containers
# modified from https://seantemple.com/proxmox/bash/admin/2017/10/01/update-all-containers.html
function update_container() {
container=$1
tmux new-window -t $2:$3 -n "$container" -d
tmux send-keys -t $2:$3 "pct exec $container -- bash -c 'apt update && apt upgrade -y && apt autoremove -y && apt clean' ; tmux wait-for -S $container" Enter
tmux wait-for $container
@dadatuputi
dadatuputi / import_milstar_pdf.py
Last active November 1, 2021 12:22
Mil Star Statement PDF to CSV
Moved to https://github.com/dadatuputi/import_milstar
@dadatuputi
dadatuputi / check_flexpool.py
Last active September 23, 2021 21:30
Nagios Flexpool Check
#!/usr/bin/python3
import requests, argparse, sys
response_data = []
# Unit data for different coins - makes display of data a bit nices
# coin: [amount to divide balance, amount to divide hashrate, unit of measurement]
coins = {
'eth': [1000000000000000000, 1000000, ''],
@dadatuputi
dadatuputi / 95.py
Created May 8, 2021 19:50
95th Percentile Logger
#!/usr/bin/env python3
import time
iface = 'enp1s0f0'
log = '95.log'
poll_interval = 1
bytes_in = '/sys/class/net/{}/statistics/rx_bytes'.format(iface)
bytes_out = '/sys/class/net/{}/statistics/tx_bytes'.format(iface)
@dadatuputi
dadatuputi / elixxir_monitor.py
Last active January 25, 2021 06:50
Elixxir Monitor
#! /usr/bin/env python3
"""elixxir_monitor.py: Monitors an elixxir node log for signs of activity and alerts when enough time elapses without activity"""
import time, subprocess, select, time, logging, signal, pushover
# Wait this long to send alert - default 5 minutes
alert_time = 60*5
logfile = "/opt/xxnetwork/node-logs/node.log"
@ECHO OFF
SETLOCAL
ECHO ASLR Enable / Diable Batch Script - Please run as admin
set /p Choice=Want to Enable or Disable ASLR? (e or d):%=%
if "%Choice%"=="e" goto :ENABLE
if "%Choice%"=="d" goto :DISABLE
:ENABLE
@dadatuputi
dadatuputi / tm_diff.py
Last active October 21, 2020 23:39
Talent Marketplace diff output
#!/usr/bin/env python3
import xlrd, argparse, openpyxl
import pandas as pd
SUFFIX_OLD = '_old'
SUFFIX_NEW = '_new'
def diff(f1, f2, o):
df1 = pd.read_excel(f1, sheet_name=0, header=0, index_col=0)
@dadatuputi
dadatuputi / podman-svc-gen.sh
Created August 18, 2020 17:40
Generate podman service files from existing containers
#!/bin/bash
podman container list -a --format "{{.Names}}" | while read i; do podman generate systemd -fn --new $i; done
@dadatuputi
dadatuputi / countryblock.py
Created June 17, 2020 02:26
Python countryblock with threshold
import requests, argparse, pathlib
from itertools import accumulate
from operator import itemgetter
def build_subnet_list(country, threshold):
"""
Return a list of the largest subnets from the designated
country that provide coverage at least up to the threshold amount
"""
@dadatuputi
dadatuputi / ancestornames.py
Created June 17, 2020 02:04
Ancestor Names
from gedcom.element.individual import IndividualElement
from gedcom.parser import Parser
file_path = 'temp.ged'
gedcom_parser = Parser()
gedcom_parser.parse_file(file_path)
root_child_elements = gedcom_parser.get_root_child_elements()
first_names = {}