Skip to content

Instantly share code, notes, and snippets.

View oesteban's full-sized avatar
🦄

Oscar Esteban oesteban

🦄
View GitHub Profile
@oesteban
oesteban / Install NVIDIA Driver and CUDA.md
Created November 5, 2023 09:37 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2023 Oscar Esteban <code@oscaresteban.es>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@oesteban
oesteban / sub-10.ipynb
Last active August 24, 2022 20:58
bias-tests
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@oesteban
oesteban / ttc2ttf
Created November 30, 2021 14:23 — forked from lilydjwg/ttc2ttf
Convert .ttc to several .ttf files into the current directory
#!/usr/bin/env python3
import sys
import fontforge
def main(file):
for font in fontforge.fontsInFile(file):
f = fontforge.open(u'%s(%s)' % (file, font))
f.generate('%s.ttf' % font)

Raspberry Pi, Static HTTPS site with Docker and Nginx

This tutorial is dated Oct 2021, if it's much further on than that this information might be out of date.

This is a guide on setting up a static HTTPS website on your raspberry pi using docker and nginx. The aim is to have this running on the raspberry pi and to be able to access it from a host computer on the same local network. You should already be able to ssh into your pi from your host computer and have raspberry pi OS set up.

Find your raspberry pi

from pathlib import Path
from nipype.pipeline import engine as pe
from nibabies.workflows.anatomical.registration import init_coregistration_wf
from nibabies.workflows.anatomical.brain_extraction import init_infant_brain_extraction_wf
from nibabies.workflows.anatomical.outputs import init_coreg_report_wf
wf = pe.Workflow(name="nibabies_anat")
be = init_infant_brain_extraction_wf(omp_nthreads=8, age_months=2)
be.inputs.inputnode.in_t2w = "/Users/oesteban/tmp/nibabies-coregistration/data/sub-MOD1319/anat/sub-MOD1319_run-14_T2w.nii.gz"
import os
import nibabel as nb
import numpy as np
from nipype.interfaces.base import isdefined
from nipype.interfaces import fsl, ants, afni
import nipype.pipeline.engine as pe
from niworkflows.interfaces.registration import (
EstimateReferenceImage,
@oesteban
oesteban / nature-brief.csl
Created September 3, 2020 09:47
Zotero citation style file
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-GB">
<info>
<title>Nature (brief style)</title>
<id>http://www.zotero.org/styles/nature</id>
<link href="http://www.zotero.org/styles/nature" rel="self"/>
<link href="http://www.nature.com/nature/authors/gta/index.html#a5.4" rel="documentation"/>
<link href="http://www.nature.com/srep/publish/guidelines#references" rel="documentation"/>
<author>
<name>Oscar Esteban</name>
"""Conforming input data."""
from pathlib import Path
from tempfile import mkdtemp
import numpy as np
import nibabel as nb
from scipy.ndimage import map_coordinates
def conform_data(in_file, out_file=None, out_size=(256, 256, 256), out_zooms=(1.0, 1.0, 1.0), order=3):
"""Conform the input dataset to the canonical orientation."""

Fieldmaps table

This is the table

+----------+-------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Priority | Data | Behavior | +==========+===================================================================================================================+=============================================================================================================================================================================================