Skip to content

Instantly share code, notes, and snippets.

View evu's full-sized avatar
🌎
>>> ▌

evu

🌎
>>> ▌
View GitHub Profile
@evu
evu / _jaccard.py
Created January 20, 2023 00:00 — forked from JDWarner/_jaccard.py
Jaccard coefficient between two boolean NumPy arrays or array-like data. This is commonly used as a set similarity metric, and it is a true metric. The dimensionality of the input is completely arbitrary, but `im1.shape` and `im2.shape` much be equal. This Gist is licensed under the modified BSD license, otherwise known as the 3-clause BSD.
"""
_jaccard.py : Jaccard metric for comparing set similarity.
"""
import numpy as np
def jaccard(im1, im2):
"""
@evu
evu / ssh-retry.sh
Created July 26, 2022 22:20 — forked from 9point6/ssh-retry.sh
Keep retrying SSH connection until success (Useful for waiting for VMs to boot)
#!/usr/bin/env bash
# Check we've got command line arguments
if [ -z "$*" ] ; then
echo "Need to specify ssh options"
exit 1
fi
# Start trying and retrying
((count = 100))

Pansharpening notes, mid-2021

Preface

This is a collection of notes on how I’ve been approaching CNNs for pansharpening. It’s an edited version of an e-mail to a friend, who had asked about this tweet, and so it’s informal and somewhat silly; it is not as polished as, say, a blog post would be. Basically, what I’ve written up here is the advice I would give to an enthusiastic image processing hobbyist before they started working on pansharpening.

If you want a more serious brief review of the problem, try the first two pages of Learning deep multiresolution representations for pansharpening – most of the work I would recommend is mentioned there.

If you spot an error in the physics or math here, please mention it, but if you see a simplification or minor abuse of terminology, it’s on purpose; for textbook rigor, please refer to a textbook. The focus here is

@evu
evu / psycopg2_cheatsheet.md
Created January 30, 2020 18:33 — forked from pfigue/psycopg2_cheatsheet.md
psycopg2 Cheatsheet

Connect and Select

connect()

The shortest connect:

from psycopg2 import connect
psql_conn = connect("dbname=XXX user=XXX password=XXX host=localhost sslmode=require")
psql_conn.close()
@evu
evu / self-signed-certificate-with-custom-ca.md
Created June 14, 2019 17:25 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@evu
evu / curl.md
Created August 1, 2018 22:32 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@evu
evu / condaenv.txt
Last active July 31, 2018 13:52 — forked from pratos/condaenv.txt
To package a conda environment (Requirement.txt and virtual environment)
# To create a conda environment:
conda create --name <environment-name> python=<version:2.7/3.5>
# To create a requirements.txt file:
conda list
conda list -e > requirements.txt
# To export environment to a file:
activate <environment-name>
conda env export > <environment-name>.yml