Skip to content

Instantly share code, notes, and snippets.

View Dirga36's full-sized avatar
🤔

Fu'ad Husnan Dirga36

🤔
View GitHub Profile
import boto3
import json
s3 = boto3.client("s3")
def lambda_handler(event, context):
for record in event["Records"]:
bucket = record["s3"]["bucket"]["name"]
key = record["s3"]["object"]["key"]
import hashlib
import boto3
from pathlib import Path
s3 = boto3.client("s3")
def file_hash(path: Path) -> str:
return hashlib.md5(path.read_bytes()).hexdigest()
def sync_directory(local_dir: str, bucket: str, prefix: str = "") -> None:
import boto3
from pathlib import Path
s3 = boto3.client("s3")
def upload_file(local_path: str, bucket: str, s3_key: str) -> None:
"""Upload a single file to S3, preserving content type where possible."""
path = Path(local_path)
if not path.exists():
raise FileNotFoundError(f"No such file: {local_path}")
pip install boto3
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_DEFAULT_REGION="us-east-1"
import pandas as pd
df = pd.read_csv("survey_responses.csv")
# Standardize inconsistent text entries in the "country" column
df["country"] = df["country"].str.strip().str.title()
df["country"] = df["country"].replace({
"Usa": "United States",
"U.S.": "United States",
"Uk": "United Kingdom"
let angle = Math.PI / 4;
let angleVelocity = 0;
const angleAcceleration = 0;
const length = 200;
const gravity = 0.4;
function setup() {
createCanvas(400, 400);
}
# Example decision audit log entry
decision_id: "d-88213"
timestamp: "2026-03-14T09:12:00Z"
model_version: "credit-risk-v4.2.1"
input_features_hash: "a91f...c3d2"
prediction: "denied"
confidence_score: 0.87
explainability_report_ref: "shap-report-88213.json"
reviewed_by_human: false
import shap
import xgboost as xgb
# Train a model on your dataset (X_train, y_train assumed pre-processed)
model = xgb.XGBClassifier()
model.fit(X_train, y_train)
# Create an explainer and compute SHAP values for the test set
explainer = shap.TreeExplainer(model)
shap_values = explainer.shap_values(X_test)
@Dirga36
Dirga36 / cax.java
Last active January 10, 2026 12:29
cax
cax = new DoodleUnitType("cax") {{
constructor = TankUnit::create;
aiController = GroundAI::new;
//attributes
hitSize = 50f;
treadPullOffset = 1;
speed = 0.7f;
health = 17000;
armor = 30f;
@Dirga36
Dirga36 / app.py
Created November 2, 2025 06:43
Python script for printing "hello world"
print("hello world")