Skip to content

Instantly share code, notes, and snippets.

View chbrandt's full-sized avatar

Carlos H Brandt chbrandt

View GitHub Profile
@althonos
althonos / setup.cfg
Last active March 4, 2024 18:08
A `setup.cfg` template for my Python projects
# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c
[metadata]
name = {name}
version = file: {name}/_version.txt
author = Martin Larralde
author_email = [email protected]
url = https://github.com/althonos/{name}
description = {description}
long_description = file: README.md
@brendancol
brendancol / rasterio_datashader_polygons.py
Last active December 17, 2020 21:43
Datashader + Rasterio for Polygon shading (40K Polygons, 81M Vertices)
from __future__ import division
from functools import partial
import pyproj
from shapely.ops import transform
import numpy as np
from rasterio import features
from affine import Affine
import fiona
@sanelson
sanelson / python_mp_progress.py
Created May 1, 2016 16:58
Python Multiprocessing with simple progress tracking via queues in main process
from progressbar import ProgressBar, SimpleProgress
from multiprocessing import Process, Queue
from time import sleep
import progressbar
class Worker():
def __init__(self, name, result_queue, process):
self.name = name
@jqtrde
jqtrde / modern-geospatial-python.md
Last active August 1, 2023 14:50
Modern remote sensing image processing with Python
@christianberg
christianberg / Dockerfile
Last active January 10, 2023 16:58
Sharing a unix socket between a Docker container and it's host
FROM ubuntu
RUN apt-get update
RUN apt-get install -y socat
VOLUME /foo
CMD socat UNIX-LISTEN:/foo/bar.sock -
@soheilhy
soheilhy / nginxproxy.md
Last active October 23, 2024 08:19
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active October 27, 2024 19:13
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost