Skip to content

Instantly share code, notes, and snippets.

View neibla's full-sized avatar

Neil Blake neibla

View GitHub Profile
@neibla
neibla / modal_cell_segmentation_pipeline.py
Created October 14, 2024 18:09
Modal RXRX Cell Segmentation
import modal
import os
import modal.parallel_map
import numpy as np
s3_bucket_name = "cell-segmentation-data-a05c1c99b4410510"
os.environ["AWS_REGION"] = "us-west-2"
CELLPOSE_MODELS_DIR = "~/.cellpose/models"
# cell segmentation for the rxrx dataset (https://www.rxrx.ai/rxrx19a#Download) powered by Modal
@neibla
neibla / python debug.md
Created February 17, 2024 03:53
Python debug with pdb

python -m pdb myscript.py

import pdb, traceback, sys

def bombs():
    a = []
    print a[0]
@neibla
neibla / run_subprocess.py
Created June 19, 2022 09:30
Python run process/get output
import subprocess
ls_process = subprocess.run(["ls","/usr/bin"], stdout=subprocess.PIPE)
grep_process = subprocess.run(["grep","python"], input=ls_process.stdout, stdout=subprocess.PIPE)
print(grep_process.stdout.decode("utf-8"))
@neibla
neibla / voc_to_yolo.py
Last active November 20, 2021 08:42
Convert VOC annotations to the YOLO format
from typing import List
import xml.etree.ElementTree as ET
import os
import sys
from pathlib import Path
def convert(size, box):
dw = 1./(size[0])
@neibla
neibla / gist:4723eac273f6c0f39fbc17880cb9cc58
Created September 14, 2021 11:24
Setup tensoflow/cuda/pytorch on fresh Ubuntu install
# https://lambdalabs.com/lambda-stack-deep-learning-software
# Setup tensoflow/cuda/pytorch on fresh Ubuntu install
LAMBDA_REPO=$(mktemp) && \
wget -O${LAMBDA_REPO} https://lambdalabs.com/static/misc/lambda-stack-repo.deb && \
sudo dpkg -i ${LAMBDA_REPO} && rm -f ${LAMBDA_REPO} && \
sudo apt-get update && sudo apt-get install -y lambda-stack-cuda
sudo reboot
sudo apt-get purge nvidia-*
sudo apt autoremove --purge cuda*
sudo apt-get purge cuda*
sudo apt autoremove
sudo rm -rf /usr/local/cuda*
sudo reboot
setup with lambda
@neibla
neibla / gist:6459edef27944cc53f706181184d77a8
Created August 15, 2021 08:31
Purging Cuda (stuck in some weird uninstall cycle
Start with
sudo apt purge *nvidia*
then run
sudo dpkg --remove --force-remove-reinstreq x
where x is the dependent output from the previous line
should end up with something like:
sudo dpkg --remove --force-remove-reinstreq cuda
sudo dpkg --remove --force-remove-reinstreq cuda-9-2
sudo dpkg --remove --force-remove-reinstreq cuda-runtime-9-2
@neibla
neibla / gist:510b46081007b20c776ca2a06439c29f
Created June 30, 2021 02:47
Setting up Tensorflow with AMD GPU on Macos via metal
https://developer.apple.com/metal/tensorflow-plugin/
virtualenv -p /usr/bin/python3 myenv
source myenv/bin/activate
python -m pip install -U pip
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=true
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=true
python3 -m pip install --upgrade setuptools
@neibla
neibla / README.md
Created June 20, 2021 03:11 — forked from tannerlinsley/README.md
Replacing Create React App with the Next.js CLI

Replacing Create React App with the Next.js CLI

How dare you make a jab at Create React App!?

Firstly, Create React App is good. But it's a very rigid CLI, primarily designed for projects that require very little to no configuration. This makes it great for beginners and simple projects but unfortunately, this means that it's pretty non-extensible. Despite the involvement from big names and a ton of great devs, it has left me wanting a much better developer experience with a lot more polish when it comes to hot reloading, babel configuration, webpack configuration, etc. It's definitely simple and good, but not amazing.

Now, compare that experience to Next.js which for starters has a much larger team behind it provided by a world-class company (Vercel) who are all financially dedicated to making it the best DX you could imagine to build any React application. Next.js is the 💣-diggity. It has amazing docs, great support, can grow with your requirements into SSR or static site generation, etc.

So why

version: "3.7"
services:
database:
image: "postgres:13.1"
environment:
POSTGRES_PASSWORD: "password"
# env_file:
# - database.env # configure postgres
volumes: