Skip to content

Instantly share code, notes, and snippets.

View VinQbator's full-sized avatar

Eva Lond VinQbator

  • Tallinn, Estonia
View GitHub Profile
@miguelmota
miguelmota / buildspec.yml
Last active October 18, 2021 03:23
AWS CodePipeline CodeBuild middleman build deploy to S3 and invalidate cloudfront cache
version: 0.1
phases:
install:
commands:
- apt-get update
- apt-get install nodejs -y
- gem install bundler
- gem install middleman
pre_build:
commands:
@ignamv
ignamv / format_si.py
Created May 21, 2016 19:30
Python SI prefix formatting
def format_si(number, significant_digits=3):
"""Format number using SI prefixes
The prefix is chosen such that the number before the prefix is 1<x<1000."""
if number == 0:
return '0 '
prefixes = list('afpnμm') + [''] + list('kMGTPE')
multipliers = 10.**np.arange(-18, 19, 3)
inv_multipliers = 10.**(-np.arange(-18, 19, 3))
abs_number = abs(number)