Skip to content

Instantly share code, notes, and snippets.

View rlizzo's full-sized avatar

Rick Izzo rlizzo

  • NVIDIA
  • Morristown, NJ
  • 06:30 (UTC -04:00)
  • LinkedIn in/rlizzo
View GitHub Profile
@rlizzo
rlizzo / script-template.sh
Created December 17, 2020 03:05 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@rlizzo
rlizzo / grpc_asyncio.py
Created August 26, 2018 19:39 — forked from mmellison/grpc_asyncio.py
gRPC Servicer with Asyncio (Python 3.6+)
import asyncio
from concurrent import futures
import functools
import inspect
import threading
from grpc import _server
def _loop_mgr(loop: asyncio.AbstractEventLoop):
@rlizzo
rlizzo / numpy-fast-symmetric-pad.py
Created December 14, 2017 16:52 — forked from slode/numpy-fast-symmetric-pad.py
A faster numpy pad algorithm where the padding mode is symmetric along the axes.
"""
Copyright (c) 2017 Stian Lode,
stian.lode@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@rlizzo
rlizzo / DicomNoMeta.py
Created December 6, 2017 08:43
Anonymize DICOM data
'''
DicomNoMeta.py
For University Hospital in Krakow DICOMs
Jan Witowski / Garage of Complexity
Usage: DicomNoMeta.py <path>
Anonymizes all personal data
'''
import dicom
@rlizzo
rlizzo / build_simpleitk_anaconda.md
Created October 24, 2017 09:05 — forked from somada141/build_simpleitk_anaconda.md
Build SimpleITK against Anaconda Python on OSX #python #anaconda #conda #simpleitk #itk #build #source #cmake #osx

The following process shows how one would build SimpleITK (from source) to link against and work with the Anaconda Python environment on Mac OSX.

The majority of this process can be applied to other non-vanilla Python interpreters such as Enthought Canopy and Enthough Python Distribution (EPD). This process has also been tried on Windows 7 with Canopy.

Here's how one would go about building SimpleITK against their Anaconda Python:

  • Activate your preferred conda environment. I will assume its called py27 but be careful to amend appropriately and activate through source activate <environment_name>
  • Go to this link: http://www.itk.org/Wiki/SimpleITK/GettingStarted#Build_It_Yourself and take a look at the instructions for building SimpleITK first.
  • Make sure you have CMake installed (I used the 2.8.12 version while writing this but you may want to opt for the newest CMake version first).
  • Make sure you have
@rlizzo
rlizzo / scheduler.py
Created October 4, 2017 03:42 — forked from sebgoa/scheduler.py
A random toy kubernetes scheduler in python
#!/usr/bin/env python
import time
import random
import json
from kubernetes import client, config, watch
config.load_kube_config()
v1=client.CoreV1Api()