Skip to content

Instantly share code, notes, and snippets.

View perusio's full-sized avatar

António P. P. Almeida perusio

View GitHub Profile
@Nathan-Furnal
Nathan-Furnal / python-setup-init.el
Created May 18, 2022 19:05
Trimmed down python setup for Emacs. This is a basic `init.el` file for Python, you can pick the bits you like.
;;; init.el --- Fun stuff all around -*- lexical-binding: t; -*-
;;; Commentary:
;; This is a simple init.el which offers a Python configuration. Each package
;; usage is annotated with the how and why of its use. `use-package' is used to
;; manage the configuration as it provides lots of facilities to load modes,
;; define custom variables and key-maps, etc.
;;; Code:
@maphew
maphew / gdal-copy-rpc.py
Created January 10, 2022 15:56
Copy RPC metdata from IN raster to OUT raster
'''Copy RPC metdata from IN raster to OUT raster
Adapted from @user7821537
https://gis.stackexchange.com/questions/264644/transfer-rpc-metadata-from-one-geotiff-to-another
'''
import os
import sys
from osgeo import gdal
gdal.UseExceptions()

Pansharpening notes, mid-2021

First posted in August 2021. This is basically a snapshot of my thinking about pansharpening at that time; I’m not making any substantial updates. Last typo and clarity fixes in February 2023.

Preface

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

If you want a more serious introduction, start with the literature review in Learning deep multiresolution representations for pansharpening. Most of the academic work I would recommend is mentioned there.

@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@tyhoff
tyhoff / progress_bar_requests_upload.py
Last active May 5, 2024 09:36
Python requests HTTP PUT with tqdm progress bar
from tqdm import tqdm
from tqdm.utils import CallbackIOWrapper
file_path = os.path.abspath(__file__)
upload_url = https://some-bucket.s3.amazonaws.com
file_size = os.stat(file_path).st_size
with open(file_path, "rb") as f:
with tqdm(total=file_size, unit="B", unit_scale=True, unit_divisor=1024) as t:
wrapped_file = CallbackIOWrapper(t.update, f, "read")
@supriya-premkumar
supriya-premkumar / dockerCheatSheet.md
Last active January 4, 2023 11:29
Docker Commands
@thomasnorris
thomasnorris / Raspberry Pi Kiosk Setup.md
Last active October 22, 2023 03:36
Instructions for installing a fresh image of Raspbian and turning the Pi into a kiosk (for google slides, google photos, etc)

Raspberry Pi Kiosk Setup

  • Install a fresh image of Raspbian and boot the Pi
  • Go through the prompts to finish initial setup
  • Open a Termial window
    • Type sudo apt-get install unclutter
    • Type sudo raspi-config
      • Select Boot Options with Enter
        • Select Wait for Network at Boot with Enter
        • Select Yes with Enter
@caseywatts
caseywatts / 0 README.md
Last active May 2, 2024 05:47
Generate Graphviz Files for Project

short url: caseywatts.com/graphviz

Graphviz is like markdown, for diagrams.

It's a tool that can transform text input into a "directed graph" output, which is nodes pointing to other nodes. You can use it for architecture diagrams, DB diagrams, documentation for users, etc.

graphviz-it

You'll want to use a tool with a two-pane layout - the left side is the source text, the right side is the image output.

  • For just you working on it, use (shown above; it has more features)
@bitingsock
bitingsock / cycle-adevice.lua
Last active January 29, 2024 03:10
Cycle through available audio devices with key binds(shift+a,ctrl+a). Change "wasapi" on line 1 to your relevant audio api.
local api = "wasapi"
local deviceList = mp.get_property_native("audio-device-list")
local aid = 1
local function cycle_adevice(s, e, d)
mp.enable_messages("error")
while s ~= e + d do -- until the loop would cycle back to the number we started on
if string.find(mp.get_property("audio-device"), deviceList[s].name, 1, true) then
while true do
if s + d == 0 then --the device list starts at 1; 0 means we iterated to far
s = #deviceList + 1 --so lets restart at the last device
@marklkelly
marklkelly / nginx.conf
Last active December 10, 2023 03:19
OpenResty & ssl_certificate_by_lua_file example
#Simplified for illustrative purposes.
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;