Skip to content

Instantly share code, notes, and snippets.

@nbassler
nbassler / template.py
Created November 15, 2019 15:16
Python Script Template
import sys
import logging
import argparse
logger = logging.getLogger(__name__)
def main(args=sys.argv[1:]):
""" Main function for trip2dicom.py
"""
@nbassler
nbassler / pretty_float.py
Last active December 16, 2019 18:42
A nicer way to print floating point values.
from math import log10
from math import floor
def pretty(x, min_digits=4, exponent=2):
"""
A nicer way to print floats than the {:g} format.
min_digits: the minimum number of significant digits which will be printed.
@nbassler
nbassler / mytypes.c
Last active February 13, 2023 19:54
test platform dependent types
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
int main(void) {
size_t *s;
double *d;
int *i;