Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python3
# https://stackoverflow.com/questions/64991055/can-i-get-the-most-recent-commit-of-a-repository-with-bitbucket-api
import requests
from requests.auth import HTTPBasicAuth
##Login
username = '<<bitbucket user>>'
password = '<<app password>>'
@teopost
teopost / zext_ssl_expiry.sh
Created April 26, 2022 07:28
zext_ssl_expiry.sh - check for expired certificates
#! /bin/sh
SERVER=$1
TIMEOUT=5
RETVAL=0
SNI=$3
TIMESTAMP=`echo | date`
if [ -z "$2" ]; then
PORT=443;
else
PORT=$2;
@teopost
teopost / ubuntu-sleep.yaml
Last active October 31, 2023 09:55 — forked from tcdowney/ubuntu-sleep.yaml
Ubuntu Sleep Pod
# kubectl apply -f https://gist.githubusercontent.com/teopost/0ae4af9d5b6f2fa79283dca29fd77f1c/raw/eaae035f5adca37ca00d4a49f1c1958fe3db89e3/ubuntu-sleep.yaml
# kubectl exec -it ubuntu -- /bin/bash
# apt update && apt-get install -y telnet curl net-tools ssh nmap iputils-ping bind9-utils
# oppure:
# kubectl run -i --tty busybox --image=busybox --restart=Never -- sh
apiVersion: v1
kind: Pod
metadata:
name: ubuntu
labels:
#!/bin/sh
MakeCert(){
domain=$1
openssl req -x509 -nodes -days 9000 -newkey rsa:2048 -keyout ${domain}.key -out ${domain}.crt \
-subj "/C=IT/ST=Italy/L=Rimini/O=Acme srl/OU=IT Department/CN=${domain}"
}
@teopost
teopost / create-apache-aws-whitelist.py
Last active October 8, 2020 07:50
Create AWS whitelist for apache
#!/usr/bin/env python
import requests
ip_ranges = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json').json()['prefixes']
amazon_ips = [item['ip_prefix'] for item in ip_ranges if item["region"] == "eu-west-1"]
#ec2_ips = [item['ip_prefix'] for item in ip_ranges if item["service"] == "EC2"]
#amazon_ips_less_ec2=[]
@teopost
teopost / installer-nmon-as-a-service.sh
Last active June 23, 2020 14:52
Installer nmon as a service
#!/bin/sh
# nmon as a service
# installer script for red-hat 7.5
yum install -y nmon
if [ $? -eq 1 ]; then
# Download NMON archive
cd /tmp
wget http://sourceforge.net/projects/nmon/files/nmon16e_mpginc.tar.gz
#!/bin/sh
#export filename=$(date +%Y%m%d-%H%M%S)
export filename=backup-website
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
#!/usr/bin/python
# -*- coding: utf-8 -*-
import csv
from jira import JIRA
options = {'server': 'https://server.atlassian.net'}
jira = JIRA(options, basic_auth=('s.teodorani@acme.it', 'xxxxxx'))
size = 1000
initial = 0
* https://www.ccworld.it/2015/10/retropie-stazione-di-emulazione-retrogaming-con-raspberry-pi/
* https://romsmania.cc
* https://archive.org/details/MAME2003_Reference_Set_MAME0.78_ROMs_CHDs_Samples
function displaytime {
local T=$1
local D=$((T/60/60/24))
local H=$((T/60/60%24))
local M=$((T/60%60))
local S=$((T%60))
printf "%s days, %s hours, %s mins, %s secs" "$D" "$H" "$M" "$S"
}