Skip to content

Instantly share code, notes, and snippets.

View giannitedesco's full-sized avatar

Gianni Tedesco giannitedesco

View GitHub Profile
@giannitedesco
giannitedesco / starship.toml
Created January 11, 2026 10:35
Current starship config
"$schema" = 'https://starship.rs/config-schema.json'
format = """
[](color_orange)\
$os\
$username\
[](bg:color_yellow fg:color_orange)\
$directory\
[](fg:color_yellow bg:color_aqua)\
$git_branch\
@giannitedesco
giannitedesco / consumer-spool.py
Created January 9, 2026 12:03
Use minotaur to consume files from a spool dir
from pathlib import Path
from minotaur import Inotify, Mask
import logging
__al
@giannitedesco
giannitedesco / hist.py
Created December 10, 2023 10:37
Boilerplate for histograms
#!/usr/bin/python
import matplotlib.pyplot as plt
import numpy as np
from pathlib import Path
from math import log
from sys import argv
def hist(p: Path) -> None:
vals = [int(x) for x in p.read_text().splitlines()]
#!/usr/bin/env python3
__title__ = 'silverhand'
__description__ = 'breach protocol puzzle solver'
__copyright__ = 'Copyright 2020 Gianni Tedesco'
__author__ = 'Gianni Tedesco'
__author_email__ = 'gianni@scaramanga.co.uk'
__license__ = 'MIT'
from collections import defaultdict
@giannitedesco
giannitedesco / hibp.py
Last active December 14, 2020 09:17
Tool to check haveibeenpwnd password database
#!/usr/bin/python
__author__ = 'Gianni Tedesco'
__url__ = 'https://github.com/giannitedesco/'
__license__ = 'Public Domain'
from hashlib import sha1
from getpass import getpass
import httpx
@giannitedesco
giannitedesco / gash.py
Created August 30, 2018 08:13
Send secret messages to someone using their public ssh key
#!/usr/bin/python3
__copyright__ = "Copyright (c) 2018 Gianni Tedesco"
__licence__ = "GPLv3"
__doc__ = "Tool for sending secret messages using ssh keys"
from argparse import ArgumentParser
try:
import nacl.utils
from nacl.signing import SigningKey,VerifyKey
@giannitedesco
giannitedesco / readkeys.py
Created August 28, 2018 12:21
Parse openssh public and private keys, only ed25519
#!/usr/bin/python3
try:
from nacl.signing import SigningKey
_nacl = True
except:
_nacl = False
from base64 import b64decode
from struct import unpack
from iquery import IQuery
from entry import Entry
class IQueryFast(IQuery):
def __init__(self, sz, e):
super(IQueryFast, self).__init__(sz)
e = [x for x in e]
e.append(Entry(0, sz, None))
@giannitedesco
giannitedesco / poly.py
Created July 17, 2014 01:22
Take a list of numbers and find a polynomial function that describes them
#!/usr/bin/python
# vim: set fileencoding=utf8 :
import numpy as np
def finite_differences(y):
"Use method of finite differences to determine "
"what order of polynomial to look for"
inp = y[:]
@giannitedesco
giannitedesco / cmath.h
Created July 14, 2013 12:58
A minheap implementation in C. Does some pointer arithmetic to achieve one-based indexing without wasting memory. API amenable to static bounds checking.
/*
* This file is part of cola
* Copyright (c) 2013 Gianni Tedesco
* This program is released under the terms of the GNU GPL version 3
*/
#ifndef _CMATH_H
#define _CMATH_H
#include <bits/wordsize.h>