Skip to content

Instantly share code, notes, and snippets.

View kcho's full-sized avatar

Kang Ik Kevin Cho kcho

  • Psychiatry Neuroimaging Laboratory
  • Boston, MA, USA
View GitHub Profile
@mdonkers
mdonkers / server.py
Last active June 14, 2025 20:50
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import numpy as np
def loadSparseMatrix(filename):
"""
Loads the sparse matrix in text file `filename` assuming the
Matlab format.
Each row of the file should specify the non-zero value
at a particular location, using 1 based indexes, formatted as follows: