4337 links
  • Arnaud's links
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
page 1 / 1
2 results tagged calc x
  • whisper calculator

    !/usr/bin/env python

    -- coding: utf-8 --

    def archive_to_bytes(archive):
    def to_seconds(s):
    SECONDS_IN_A = {
    's': 1,
    'm': 1 60,
    'h': 1
    60 60,
    'd': 1
    60 60 24,
    'y': 1 60 60 24 365,
    }

        return int(s[:-1]) * SECONDS_IN_A[s[-1]]
    
    archive = [map(to_seconds, point.split(':'))
               for point in args.archive.split(',')]
    
    SIZE_METADATA = 2 * 4 + 4 + 4  # 16 [!2LfL]
    SIZE_ARCHIVE_INFO = 3 * 4  # 12 [!3L]+
    SIZE_POINT = 4 + 8  # 12 [!Ld]+
    
    size = 0
    for resolution, retention in archive:
        size += SIZE_ARCHIVE_INFO + SIZE_POINT * retention/resolution
    
    if size:
        size += SIZE_METADATA
    
    return size

    if name == 'main':
    import argparse

    parser = argparse.ArgumentParser(
        description="Calculates the size of the whisper storage for the given \
                archive (in resolution:retention format, e.g. 1m:24h,5m:3m)"
    )
    parser.add_argument(
        'archive',
        help="Archive in storage-schemas.conf format (resolution:retention)"
    )
    
    args = parser.parse_args()
    
    print "{} >> {} bytes".format(args.archive, archive_to_bytes(args.archive))
    July 24, 2014 at 10:14:44 AM GMT+2 - permalink - archive.org - https://gist.github.com/jjmaestro/5774063#file-whisper-calculator-py
    calc graphite whisper
  • Byte Converter - Bytes to Kilobytes to Megabytes to Gigabytes to Terabytes
    November 13, 2013 at 5:53:21 PM GMT+1 - permalink - archive.org - http://www.whatsabyte.com/P1/byteconverter.htm
    bit byte calc conversion convert converter
Links per page: 20 50 100
page 1 / 1
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Help/documentation