Skip to content

Instantly share code, notes, and snippets.

View chbrandt's full-sized avatar

Carlos H Brandt chbrandt

View GitHub Profile
@chbrandt
chbrandt / ipython-0.0.1.py
Created November 8, 2023 11:03 — forked from fperez/ipython-0.0.1.py
IPython 0.0.1, a simple script to be loaded as $PYTHONSTARTUP: of historical interest only...
#!/usr/bin/env python
"""
Interactive execution with automatic history, tries to mimic Mathematica's
prompt system. This environment's main features are:
- Numbered prompts (In/Out) similar to Mathematica. Only actions that produce
output (NOT assingments, for example) affect the counter and cache.
- The following GLOBAL variables always exist (so don't overwrite them!):
_p: stores previous result which generated printable output.
@chbrandt
chbrandt / quote.txt
Created October 26, 2020 11:08 — forked from OnesimusUnbound/quote.txt
Programming Quotes
[T]he difference between a bad programmer and a
good one is whether he considers his code or his
data structures more important. Bad programmers
worry about the code. Good programmers worry about
data structures and their relationships.
-- Linus Torvalds
~~~
Clarity and brevity sometimes are at odds.
When they are, I choose clarity.
-- Jacob Kaplan-Moss
@chbrandt
chbrandt / modern-geospatial-python.md
Last active November 28, 2019 07:47 — forked from jqtrde/modern-geospatial-python.md
Modern remote sensing image processing with Python
@chbrandt
chbrandt / download_file.py
Created September 9, 2019 11:27 — forked from ruxi/download_file.py
python download_file with progressbar using request and tqdm
#!/usr/bin/env python
__author__ = "github.com/ruxi"
__license__ = "MIT"
import requests
import tqdm # progress bar
import os.path
def download_file(url, filename=False, verbose = False):
"""
Download file with progressbar
@chbrandt
chbrandt / download.py
Last active September 9, 2019 11:09 — forked from wy193777/download.py
Download file through HTTP using requests.py and tqdm
import os
import requests
from tqdm import tqdm
def download_from_url(url, dst):
"""
@param: download file URL
@param: output file name
"""
file_size = int(requests.head(url).headers["Content-Length"])
@chbrandt
chbrandt / dummy-web-server.py
Created June 16, 2017 11:05 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost