If You Ask These 4 Python Questions, You Might Still Be a Nooby

Medium: If You Ask These 4 Python Questions, You Might Still Be a Nooby. https://medium.com/geekculture/if-you-ask-these-4-python-questions-you-might-still-be-a-nooby-7e4c503aa1c3

PyScript: Making Python Scripts Work In Browser For Web App Creation

Search Engine Journal: PyScript: Making Python Scripts Work In Browser For Web App Creation. https://www.searchenginejournal.com/python-scripts-web-app-creation/454348/

4 Automation Projects in Python You Can Finish in a Weekend

https://medium.com/geekculture/4-automation-projects-in-python-you-can-finish-in-a-weekend-edd2b389c8e5

Optical Character Recognition using PaddleOCR

https://learnopencv.com/optical-character-recognition-using-paddleocr/

Hosting Static Website using FastAPI and Uvicorn

Here is an example program that allows you to host a static website with HTML, CSS and JPEG files using FastAPI and Uvicorn. The example assumes that all the static files are located inside the “site” directory and its sub-directories (e.g. css, images sub-directories etc).

from os.path import isfile
from fastapi import Response
from mimetypes import guess_type
from fastapi.responses import FileResponse
from fastapi import FastAPI

app = FastAPI()

@app.get("/{filename}")
async def get_site(filename):
    filename = './site/' + filename

    if not isfile(filename):
        return Response(status_code=404)
    else:
        return FileResponse(filename)

@app.get("/")
async def get_site_default_filename():
    return await get_site('index.html')

You should be reading academic computer science papers – Stack Overflow Blog

https://stackoverflow.blog/2022/04/07/you-should-be-reading-academic-computer-science-papers/

As working programmers, you need to keep learning all the time. You check out tutorials, documentation, Stack Overflow questions, anything you can find that will help you write code and keep your skills current. But how often do you find yourself digging into academic computer science papers to improve your programming chops? 

Python Code to Generate and Decode QR Code

Genius Builds Computer Inside Minecraft That Can Run Its Own Games

https://futurism.com/the-byte/computer-minecraft-run-games

OOP in Python | OOPs Concepts in Python For Beginners

https://www.analyticsvidhya.com/blog/2021/05/oop-in-python-for-absolute-beginners/

Quick Guide to nawk

Quick Reference Guide

Quick Guide to nawk

nawk (new awk) extends the original awk with more built-in functions, better string handling, and user-defined functions. Most modern systems have both installed; nawk is generally preferred. This guide covers syntax, built-in variables, patterns, string functions, control flow, arrays, and common one-liners.

Note: This guide was originally published in 2006 and has been substantially expanded in May 2026 with full content, with assistance from Claude (Anthropic).

Basic Syntax

nawk reads input line by line and applies rules of the form pattern { action }. If the pattern matches the current line, the action is executed. Either part is optional.

nawk 'pattern { action }' file
nawk -f script.awk file       # read program from a file
nawk -F: '{ print $1 }' file  # set field separator to :

Each input line is automatically split into fields. $0 is the entire line; $1, $2, … are individual fields. The default field separator is whitespace.

Built-in Variables

VariableMeaning
$0The entire current input line
$1, $2, ...$NFIndividual fields (1-based)
NFNumber of fields in the current line
NRTotal number of records (lines) read so far
FNRRecord number within the current file (resets per file)
FSInput field separator (default: whitespace)
OFSOutput field separator (default: space)
RSInput record separator (default: newline)
ORSOutput record separator (default: newline)
FILENAMEName of the file currently being processed

Patterns

Patterns control which lines trigger an action. The four main types:

PatternMeaning
BEGINRuns once before any input is read. Use for initialisation.
ENDRuns once after all input is processed. Use for summaries.
/regex/Matches lines where the regex matches anywhere in $0.
expressionAny comparison or boolean expression, e.g. NF > 3 or $2 == "SG".
BEGIN { print "Start" }
/error/ { print "Found error on line", NR }
NF > 5  { print "Long line:", $0 }
END   { print "Done. Total lines:", NR }

print and printf

print outputs values separated by OFS and terminated by ORS. printf gives C-style formatted output with no automatic newline.

{ print $1, $3 }                      # print fields 1 and 3
{ print $1 > "output.txt" }           # redirect to file
{ print $1 | "sort" }                 # pipe to command
{ printf "%-10s %5d\n", $1, $2 }      # formatted output

Common printf format specifiers:

SpecifierOutput
%sString
%dInteger
%fFloating point
%-10sLeft-aligned string in a field of width 10

String Functions

FunctionDescription
length(s)Length of string s (or $0 if omitted)
substr(s, m, n)Substring of s starting at position m, length n
index(s, t)Position of string t in s (0 if not found)
split(s, a, fs)Split s into array a using separator fs; returns number of fields
sub(r, s)Replace first match of regex r in $0 with s
gsub(r, s)Replace all matches of regex r in $0 with s
match(s, r)Returns position of regex r in s; sets RSTART and RLENGTH
toupper(s)Convert s to uppercase
tolower(s)Convert s to lowercase
sprintf(fmt, ...)Return a formatted string (like printf but returns rather than prints)

Control Flow

# if / else
if ($3 > 100) { print "high" } else { print "low" }

# while loop
{ i = 1; while (i <= NF) { print $i; i++ } }

# for loop
{ for (i = 1; i <= NF; i++) print $i }

# next  -- skip to next line
/^#/ { next }          # skip comment lines

# exit  -- stop processing
NR > 100 { exit }      # stop after 100 lines

Arithmetic operators: + - * / % ^. Comparison: == != < > <= >=. String match: ~ !~.

Arrays

nawk arrays are associative (keyed by string). No declaration is needed.

# count occurrences of each value in field 1
{ count[$1]++ }
END { for (k in count) print k, count[k] }

# delete an element
delete count["key"]

# check if a key exists
if ("key" in count) print "found"

Multi-dimensional arrays use comma-separated keys: arr[i,j].

Common One-liners

TaskCommand
Print field 2 of every linenawk '{ print $2 }' file
Print lines longer than 80 charsnawk 'length > 80' file
Count lines matching a patternnawk '/error/{ c++ } END{ print c }' file
Sum a column of numbersnawk '{ s += $1 } END{ print s }' file
Print unique lines (first occurrence)nawk '!seen[$0]++' file
Print line numbersnawk '{ print NR": "$0 }' file
Print last field of each linenawk '{ print $NF }' file
Replace a string in field 2nawk '{ gsub(/old/, "new", $2); print }' file
Use colon as field separatornawk -F: '{ print $1 }' /etc/passwd
Print lines between two patternsnawk '/START/,/END/' file

For the full specification, see the GNU awk manual. On most Linux systems, man nawk or man awk also gives a concise reference.