Skip to content

Instantly share code, notes, and snippets.

View antonioshadji's full-sized avatar

Antonios Hadjigeorgalis antonioshadji

View GitHub Profile
@antonioshadji
antonioshadji / aws-sso-refresh.sh
Created January 20, 2026 23:26
Run this on a schedule to keep your aws sso login refreshed with minimal disruption.
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
# Create log directory if it doesn't exist
mkdir -p "$HOME/.local/logs"
# users environment is not preserved, add necessary env vars
# export AWS_PROFILE="Your-non-default-profile"
# use different browser so it does not interupt my default browser use
export BROWSER=/Applications/Safari.app/Contents/MacOS/Safari
LOG_FILE="$HOME/.local/logs/awsrefresh.log"
@antonioshadji
antonioshadji / sys_path_update.py
Created July 16, 2025 16:56
managing sys.path with files is different folders within a project
# Folder paths are
# project-root/
# ├── notebooks/
# │ └── my_notebook.ipynb
# └── sami/
# ├── __init__.py # (recommended)
# └── my_module.py
import sys
import os
@antonioshadji
antonioshadji / .cursorrules
Created June 1, 2025 01:00 — forked from boxabirds/.cursorrules
Rock solid: turn Cursor into a rock-solid software engineering companion
# Project Policy
This policy provides a single, authoritative, and machine-readable source of truth for AI coding agents and humans, ensuring that all work is governed by clear, unambiguous rules and workflows. It aims to eliminate ambiguity, reduce supervision needs, and facilitate automation while maintaining accountability and compliance with best practices.
# 1. Introduction
> Rationale: Sets the context, actors, and compliance requirements for the policy, ensuring all participants understand their roles and responsibilities.
## 1.1 Actors
@antonioshadji
antonioshadji / default_argument.py
Last active May 26, 2025 15:33
test of python default argument definition and the results
def func(x=[]):
x.append(1)
return x
print(func())
print(func())
print(func([2]))
@antonioshadji
antonioshadji / postman-signed-headers.js
Last active August 30, 2024 21:22
Postman pre-request code that works with localhost server to include signed header in request
// This script reqires a local server to be running at localhost:3000
// to handle the cryptographic signature.
// store your signing key in your enviroment
const signingKey = pm.environment.get("signing_key");
// javascript Date.now() returns unix timestamp in ms, convert to s
const timestamp = Math.floor(Date.now() / 1000)
const method = pm.request.method.toString();
// Postman does not substitute URL parameters before running this script
@antonioshadji
antonioshadji / postmanCdn.js
Created August 29, 2024 13:04
Example of loading library from CDN in postman.
// The example at https://blog.postman.com/adding-external-libraries-in-postman/
// was failing for me due to exports, for this particular library stripping the last 3 lines loaded the library successfully.
// NOTE: this particular library does not work in Postman due to missing dependencies from node/browser
function removeLastLines(text, num) {
// Split the text into lines
const lines = text.split('\n');
// Remove the last two lines
lines.splice(-num);
@antonioshadji
antonioshadji / draw.io.py
Created July 27, 2024 20:13
Generate evenly spaced connection points for rectangular draw.io diagram shapes
""" Place the resulting output into the style of a draw.io shape.
Edit Style -> paste output at end.
"""
import numpy as np
# generate connection points for draw.io shapes
hnum=16 # sections along the horizontal
vnum=4 # sections along the vertical
precision=4
points=[]
@antonioshadji
antonioshadji / tax_calc.py
Last active January 16, 2026 15:12
Calculate income tax on taxable income
import pandas as pd
import numpy as np
# tax tables for 2026 from page 10 of https://www.irs.gov/pub/irs-drop/rp-25-32.pdf
# married filing jointly
over = [
0,
24800,
100800,
211400,
@antonioshadji
antonioshadji / Dockerfile.user
Created March 23, 2023 13:25
Dockerfile create and use non-root user inside container
ARG UNAME=antonios
ARG UID=1000
ARG GID=1000
RUN groupadd -g $GID -o $UNAME
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
RUN usermod -aG sudo $UNAME
USER $UNAME
@antonioshadji
antonioshadji / kyc.mermaid
Created July 26, 2022 17:54
Mermaid code for KYC sequence Diagram
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.