DEV Community

Otto
Otto

Posted on

5 Python Scripts That Save Me 10+ Hours/Week as a Freelancer

5 Python Scripts That Save Me 10+ Hours/Week as a Freelancer

Automating the boring parts of running a freelance business


Running a freelance business means wearing every hat: salesperson, accountant, project manager, and of course, the actual work. Here are 5 Python scripts I use (and sell) that have genuinely freed up hours every week.

1. Automated Invoice Generator

Time saved: 2-3 hours/week

Before this script, I was manually filling out invoice templates in Word. Embarrassing in retrospect.

import json
from datetime import datetime

def generate_invoice(client_data, items):
    """Generate a simple text invoice"""
    subtotal = sum(item['qty'] * item['rate'] for item in items)
    vat = subtotal * 0.20
    total = subtotal + vat

    invoice = f"""
INVOICE #{client_data['invoice_number']}
Date: {datetime.now().strftime('%Y-%m-%d')}

BILL TO:
{client_data['company']}
{client_data['address']}

SERVICES:
"""
    for item in items:
        line_total = item['qty'] * item['rate']
        invoice += f"  {item['description']}: {item['qty']}h × €{item['rate']} = €{line_total}\n"

    invoice += f"""
SUBTOTAL: €{subtotal:.2f}
VAT (20%): €{vat:.2f}
TOTAL DUE: €{total:.2f}

Payment due: 30 days
IBAN: FR76 xxxx xxxx xxxx xxxx xxxx xxx
"""
    return invoice

# Usage
client = {
    "company": "Acme Corp",
    "address": "123 Business St",
    "invoice_number": "2026-042"
}

items = [
    {"description": "Web development", "qty": 10, "rate": 85},
    {"description": "Project management", "qty": 3, "rate": 60}
]

print(generate_invoice(client, items))
Enter fullscreen mode Exit fullscreen mode

This script handles subtotals, VAT, and formats everything properly. I have a full version that exports to PDF and sends via email — that one's in my Invoice Generator Pro pack.

2. Client Email Response Templates

Time saved: 1 hour/week

Not a script exactly — but a system. I have 25 pre-written email templates for every common situation:

  • "I'm interested, what's your rate?"
  • "Can you do it for less?"
  • "We need it by tomorrow"
  • "We loved your proposal"
  • "We went with someone else"

Having these means I never stare at a blank screen. I copy, customize 10%, send.

The Email Templates Pack has 25 of these, €12.99.

3. Project Time Tracker (with Pomodoro)

Time saved: Cognitive load + billing accuracy

import time
import json
from datetime import datetime
from pathlib import Path

STATS_FILE = Path.home() / ".pomodoro_stats.json"

def pomodoro(task_name: str, duration_min: int = 25):
    """Run a single pomodoro session"""
    print(f"\n🍅 Starting: {task_name} ({duration_min} min)")
    print(f"   Started at: {datetime.now().strftime('%H:%M')}")

    try:
        for remaining in range(duration_min * 60, 0, -1):
            mins, secs = divmod(remaining, 60)
            print(f"\r{mins:02d}:{secs:02d} remaining", end="", flush=True)
            time.sleep(1)
        print(f"\n✅ Done! Great work on: {task_name}")

        # Log to JSON
        log_session(task_name, duration_min)

    except KeyboardInterrupt:
        print(f"\n⏹ Stopped early")

def log_session(task: str, duration: int):
    stats = json.loads(STATS_FILE.read_text()) if STATS_FILE.exists() else []
    stats.append({
        "task": task,
        "duration_min": duration,
        "date": datetime.now().isoformat()
    })
    STATS_FILE.write_text(json.dumps(stats, indent=2))
Enter fullscreen mode Exit fullscreen mode

At the end of the week, I run a simple aggregation to see exactly how many hours I spent on each client. Billing becomes trivial.

Full version with stats dashboard and weekly reports: Pomodoro Timer CLI — €7.99.

4. DCA Investment Tracker

Personal finance clarity: priceless

As a freelancer, income is irregular. I automate my investing with DCA (Dollar-Cost Averaging) — the same amount every month regardless of price.

import json
from datetime import datetime

def simulate_dca(monthly_investment: float, buy_price: float, months: int):
    """Simulate DCA strategy"""
    total_invested = 0
    total_coins = 0

    print(f"📊 DCA Simulation: €{monthly_investment}/month at €{buy_price}")
    print("-" * 50)

    for month in range(1, months + 1):
        coins_bought = monthly_investment / buy_price
        total_invested += monthly_investment
        total_coins += coins_bought
        avg_price = total_invested / total_coins

        if month % 3 == 0:  # Print every quarter
            print(f"Month {month:2d}: Invested €{total_invested:,.0f} | "
                  f"Avg price: €{avg_price:,.0f} | "
                  f"Holdings: {total_coins:.4f}")

    return total_invested, total_coins

# Example: €500/month into BTC at €35,000 for 24 months
total_in, total_btc = simulate_dca(500, 35000, 24)
print(f"\nTotal invested: €{total_in:,.0f}")
print(f"Total BTC: {total_btc:.4f}")
Enter fullscreen mode Exit fullscreen mode

Full version with live prices via CoinGecko API: DCA Crypto Bot Python — €14.99.

5. Risk/Reward Calculator for Any Investment

Decisions based on math, not emotion

def calculate_rr(entry: float, stop_loss: float, take_profit: float, 
                  capital: float = 1000, risk_pct: float = 1.0):
    """Calculate risk/reward for a trade"""
    risk = abs(entry - stop_loss)
    reward = abs(take_profit - entry)
    rr_ratio = reward / risk if risk > 0 else 0

    max_loss_euros = capital * (risk_pct / 100)
    position_size = max_loss_euros / risk if risk > 0 else 0
    potential_gain = position_size * reward

    print(f"""
📊 Trade Analysis
================
Entry:       €{entry:,.2f}
Stop Loss:   €{stop_loss:,.2f}  (risk: €{risk:.2f})
Take Profit: €{take_profit:,.2f} (reward: €{reward:.2f})

R/R Ratio:   {rr_ratio:.1f}R {"" if rr_ratio >= 2 else "⚠️" if rr_ratio >= 1 else ""}
Position:    {position_size:.4f} units
Max Loss:    €{max_loss_euros:.2f} ({risk_pct}% of capital)
Potential:   €{potential_gain:.2f}
""")

calculate_rr(entry=35000, stop_loss=33000, take_profit=40000, capital=5000)
Enter fullscreen mode Exit fullscreen mode

Full version with interactive CLI, Kelly Criterion, and trade journal export: Risk/Reward Calculator Python — €9.99.

The Full Toolkit

If you're a freelancer who codes (or a coder who freelances), these tools pay for themselves in the first week:

  • Invoice Generator Pro — €14.99
  • Freelancer Email Templates — €12.99
  • Pomodoro Timer CLI — €7.99
  • DCA Crypto Bot Python — €14.99
  • Risk/Reward Calculator — €9.99

All available at guittet.gumroad.com


What automation have you built for your freelance business? Drop it in the comments — always looking to add to my toolkit.

Tags: python, freelance, automation, productivity, showdev

Top comments (0)