Skip to content

Instantly share code, notes, and snippets.

View fepegar's full-sized avatar

Fernando Pérez-García fepegar

View GitHub Profile
@lassoan
lassoan / endocranium.py
Last active April 12, 2020 14:12
Automatic endocranium segmentation from dry bone CT scan
# Load dry bone CT of skull into the scene and run this script to automatically segment endocranium
masterVolumeNode = slicer.mrmlScene.GetFirstNodeByClass("vtkMRMLScalarVolumeNode")
smoothingKernelSizeMm = 3.0 # this is used for closing small holes in the se
# Compute bone threshold value automatically
import vtkITK
thresholdCalculator = vtkITK.vtkITKImageThresholdCalculator()
thresholdCalculator.SetInputData(masterVolumeNode.GetImageData())
thresholdCalculator.SetMethodToOtsu()
@tvercaut
tvercaut / compresspdf2ebookpdf
Created January 10, 2020 16:59
pdf compression script
#!/bin/sh
# Sanity checks
if ! [ -x "$(command -v gs)" ]; then
echo "gs is not installed -> exit"
exit 1
fi
# Define some handy options to use with ghostscript
export PDF2PDFFLAGS="-dCompatibilityLevel=1.5 -dPDFSETTINGS=/ebook -dPrinted=false -dColorConversionStrategy=/UseDeviceIndependentColor -dDownsampleColorImages=true -dDownsampleGrayImages=true -dDownsampleMonoImages=true -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -dOptimize=true -dUseFlateCompression=true -dNOPAUSE -dBATCH -sDEVICE=pdfwrite"
@pangyuteng
pangyuteng / Dockerfile
Last active April 25, 2024 02:16
docker miniconda ubuntu
#
# ref https://github.com/tebeka/pythonwise/blob/master/docker-miniconda/Dockerfile
#
# miniconda vers: http://repo.continuum.io/miniconda
# sample variations:
# Miniconda3-latest-Linux-armv7l.sh
# Miniconda3-latest-Linux-x86_64.sh
# Miniconda3-py38_4.10.3-Linux-x86_64.sh
# Miniconda3-py37_4.10.3-Linux-x86_64.sh
#
@joyrexus
joyrexus / README.md
Last active February 24, 2024 15:16
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@karpathy
karpathy / min-char-rnn.py
Last active June 28, 2024 06:13
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)