Skip to content

Instantly share code, notes, and snippets.

View fabito's full-sized avatar
🐮
Working from home

Fábio Franco Uechi fabito

🐮
Working from home
View GitHub Profile
@fabito
fabito / raster2zarr.py
Created May 3, 2025 10:12 — forked from lucaswells/raster2zarr.py
Convert GeoTIFF to Zarr array
import matplotlib.pyplot as plt
import rasterio
from rasterio.windows import Window
import time
import zarr
def convert(raster_filepath, chunk_mbs=1):
"""
Converts raster file to chunked and compressed zarr array. Tested

Git orphan branches & working trees

Creating an ophan branch

This command will create a branch with no parent (no commit history) on a repo.

git checkout --orphan <new-branch>

Managing working trees

Manage folders linked to others branches of your repo. Do not confuse them with git submodules which are links to different repositories.

@fabito
fabito / ray_cluster_resource_dagster.py
Created March 5, 2024 08:13
RayClusterResource Dagster resource implementation that provision/deprovision a new Ray cluster on demand
from typing import Optional
from dagster import AssetExecutionContext, ConfigurableResource, Definitions, InitResourceContext, asset
from ray.autoscaler.sdk import create_or_update_cluster, run_on_cluster, teardown_cluster
class RayClusterResource(ConfigurableResource):
cluster_config: str
@fabito
fabito / 8bitdo.SMG.ini
Last active January 21, 2023 11:27
8Bitdo SN30 Pro, Super Mario Galaxy, Dolphin Profile
[Profile]
Device = evdev/0/8Bitdo SN30 Pro
Buttons/A = `TR2`|SOUTH
Buttons/B = TR|EAST
Buttons/- = SELECT
Buttons/+ = START
Buttons/Home = MODE
IR/Up = TL&`Axis 3-`
IR/Down = TL&`Axis 3+`
IR/Left = TL&`Axis 2-`
@fabito
fabito / sentry.py
Created December 13, 2022 20:02 — forked from fliphess/sentry.py
Ansible sentry callback plugin - Send all errors from ansible to Sentry
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import getpass
import logging
import logging.config
import os
import socket
try:
@fabito
fabito / gist:a3afcf242247fbf21f198dd466a90003
Created July 21, 2022 20:30
error runinference api with file corrupted
Traceback (most recent call last):
File "/venv/lib/python3.8/site-packages/apache_beam/runners/worker/sdk_worker.py", line 284, in _execute
response = task()
File "/venv/lib/python3.8/site-packages/apache_beam/runners/worker/sdk_worker.py", line 357, in <lambda>
lambda: self.create_worker().do_instruction(request), request)
File "/venv/lib/python3.8/site-packages/apache_beam/runners/worker/sdk_worker.py", line 597, in do_instruction
return getattr(self, request_type)(
File "/venv/lib/python3.8/site-packages/apache_beam/runners/worker/sdk_worker.py", line 628, in process_bundle
bundle_processor = self.bundle_processor_cache.get(
File "/venv/lib/python3.8/site-packages/apache_beam/runners/worker/sdk_worker.py", line 458, in get
@fabito
fabito / 8Bitdo SN30 Pro.cfg
Last active November 14, 2021 05:37
8Bitdo SN30 Pro
# 8Bitdo SN30 Pro - http://www.8bitdo.com/ - http://www.8bitdo.com/sn30pro-sf30pro/
# Firmware v1.37 - http://support.8bitdo.com/
input_driver = "dinput"
input_device = "Bluetooth Wireless Controller "
input_device_display_name = "8Bitdo SN30 Pro"
# Hex vid:pid and Decimal vid:pid is shown in the "log_verbosity" window, enable "log_verbosity" in retroarch.cfg and run RetroArch.
# Hex vid:pid = 2DC8:6101 -> Decimal vid:pid = 11720:24833
# input_vendor_id = "11720"
@fabito
fabito / DragonRise Inc. Generic USB Joystick.cfg
Created October 30, 2021 12:59
Retropie N64 Dragonrise controller mappings
input_device = "DragonRise Inc. Generic USB Joystick "
input_driver = "udev"
input_l_btn = "6"
input_l_btn_label = "L"
input_load_state_btn = "6"
input_r_btn = "7"
input_r_btn_label = "R"
input_save_state_btn = "7"
@fabito
fabito / k3s-gcr-sa-setup.sh
Last active August 29, 2021 21:55
Setup k3s to access GCP private repositories
cat <<EOF | sudo tee -a /etc/rancher/k3s/registries.yaml
mirrors:
gcr.io:
endpoint:
- "https://gcr.io"
- "https://us.gcr.io"
- "https://asia.gcr.io"
- "https://eu.gcr.io"
configs:
gcr.io:
@fabito
fabito / split.bash
Created September 10, 2020 04:58
split files
line_count=$(wc -l $1 | cut -d ' ' -f1)
<$1 | sort | split --additional-suffix=".txt" --numeric-suffixes="1" -l $(expr $line_count / $2 + $2 - 1) $1 "set"