Skip to content

Instantly share code, notes, and snippets.

View timmyreilly's full-sized avatar
👨‍🚀
Focusing

Tim Reilly timmyreilly

👨‍🚀
Focusing
View GitHub Profile
#!/bin/bash
# Script to remove all Zone.Identifier files from the directory
# These files are Windows metadata files created when downloading from the internet
echo "Searching for Zone.Identifier files in directory..."
# Find and count Zone.Identifier files
ZONE_FILES=$(find . -name "*:Zone.Identifier" -type f)
COUNT=$(echo "$ZONE_FILES" | grep -c "Zone.Identifier" 2>/dev/null || echo "0")

Local DB Configuration and Introduction

TLDR: run migrations against new db and set environment variables:

Add this from sample.env to env with accurate db names, user and passwords:

POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=sqfour
# Unix
echo "=== Quick System Check ===" && top -bn1 | grep "Cpu" | awk '{print "CPU Used: " 100-$8 "%"}' && free -h | grep "Mem" | awk '{print "Memory: " $3 "/" $2 " (" int($3/$2*100) "%)"}' && echo "Load: $(uptime | awk -F'load average:' '{print $2}')"
# Windows Powershell
$cpu = (Get-CimInstance Win32_Processor | Measure-Object LoadPercentage -Average).Average; $mem = Get-CimInstance Win32_OperatingSystem; $memPct = [math]::Round(($mem.TotalVisibleMemorySize - $mem.FreePhysicalMemory) / $mem.TotalVisibleMemorySize * 100, 1); Write-Host "CPU: $cpu% | Mem: $memPct% | Uptime: $((Get-Date) - $mem.LastBootUpTime | ForEach-Object {"$($_.Days)d $($_.Hours)h"})" -ForegroundColor Cyan
@timmyreilly
timmyreilly / main.tf
Created May 8, 2024 21:04
Creating azure openai instance with model deployment
provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}
variable "prefix" {
description = "Prefix for the resources (rock1)"

Let's get it going manually...

First, let's set some parameters

vars

UNIQUE="chi2"
LOCATION=westus2

Network Gismos!

Hello! Thank you for coming! We're going to look at three different tools for inspecting our networks!

The first tool we'll use is called nmap, you can install it for unix environments or windows. It's a command line tool for assessing serviceable ports in networks. It is also helpful for groking network subneting and cidr notation.

Let's see what we get when we query some IP address...

@timmyreilly
timmyreilly / dump_content.py
Created January 24, 2024 22:41
Dump content from python console
"""
you're in the python debug terminal and you need to export some pydantic models for
"""
with open("data_point.json", "w") as file:
file.write(data_point.json())
with open("model_data.json", "w") as file:
file.write(results.json())
@timmyreilly
timmyreilly / cost_estimation.py
Created January 23, 2024 23:40
Get an estimate of GPT token usage and cost 2024
import argparse
import tiktoken
from pydantic import BaseModel, Field, field_validator
pricing = {
"GPT-3.5-Turbo": {"context_limit": 4000, "prompt": 0.0015, "completion": 0.002},
"GPT-3.5-Turbo-16K": {
"context_limit": 16000,
"prompt": 0.003,

Otel Configuration

az iot hub monitor-events -n iothub2-dev-eastus --props all

1. Git flow

Fork the project, and clone to your machine from the fork.

Get your local main branch up to date with upstream's main branch:

git fetch upstream
git checkout main