4337 links
  • Arnaud's links
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
◄Older
page 101 / 217
Newer►
  • 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
  • whisper dump

    !/usr/bin/env python

    import os
    import mmap
    import struct
    import signal
    import optparse

    try:
    import whisper
    except ImportError:
    raise SystemExit('[ERROR] Please make sure whisper is installed properly')

    Ignore SIGPIPE

    signal.signal(signal.SIGPIPE, signal.SIG_DFL)

    option_parser = optparse.OptionParser(usage='''%prog path''')
    (options, args) = option_parser.parse_args()

    if len(args) != 1:
    option_parser.error("require one input file name")
    else:
    path = args[0]

    def mmap_file(filename):
    fd = os.open(filename, os.O_RDONLY)
    map = mmap.mmap(fd, os.fstat(fd).st_size, prot=mmap.PROT_READ)
    os.close(fd)
    return map

    def read_header(map):
    try:
    (aggregationType,maxRetention,xFilesFactor,archiveCount) = struct.unpack(whisper.metadataFormat,map[:whisper.metadataSize])
    except:
    raise CorruptWhisperFile("Unable to unpack header")

    archives = []
    archiveOffset = whisper.metadataSize

    for i in xrange(archiveCount):
    try:
    (offset, secondsPerPoint, points) = struct.unpack(whisper.archiveInfoFormat, map[archiveOffset:archiveOffset+whisper.archiveInfoSize])
    except:
    raise CorruptWhisperFile("Unable to read archive %d metadata" % i)

    archiveInfo = {
      'offset' : offset,
      'secondsPerPoint' : secondsPerPoint,
      'points' : points,
      'retention' : secondsPerPoint * points,
      'size' : points * whisper.pointSize,
    }
    archives.append(archiveInfo)
    archiveOffset += whisper.archiveInfoSize

    header = {
    'aggregationMethod' : whisper.aggregationTypeToMethod.get(aggregationType, 'average'),
    'maxRetention' : maxRetention,
    'xFilesFactor' : xFilesFactor,
    'archives' : archives,
    }
    return header

    def dump_header(header):
    print 'Meta data:'
    print ' aggregation method: %s' % header['aggregationMethod']
    print ' max retention: %d' % header['maxRetention']
    print ' xFilesFactor: %g' % header['xFilesFactor']
    print
    dump_archive_headers(header['archives'])

    def dump_archive_headers(archives):
    for i,archive in enumerate(archives):
    print 'Archive %d info:' % i
    print ' offset: %d' % archive['offset']
    print ' seconds per point: %d' % archive['secondsPerPoint']
    print ' points: %d' % archive['points']
    print ' retention: %d' % archive['retention']
    print ' size: %d' % archive['size']
    print

    def dump_archives(archives):
    for i,archive in enumerate(archives):
    print 'Archive %d data:' %i
    offset = archive['offset']
    for point in xrange(archive['points']):
    (timestamp, value) = struct.unpack(whisper.pointFormat, map[offset:offset+whisper.pointSize])
    print '%d: %d, %10.35g' % (point, timestamp, value)
    offset += whisper.pointSize
    print

    if not os.path.exists(path):
    raise SystemExit('[ERROR] File "%s" does not exist!' % path)

    map = mmap_file(path)
    header = read_header(map)
    dump_header(header)
    dump_archives(header['archives'])

    July 24, 2014 at 10:13:52 AM GMT+2 - permalink - archive.org - http://bazaar.launchpad.net/~amos-shapira/graphite/whisper-dump/revision/733#whisper/bin/whisper-dump.py
    dump graphite whisper
  • Introducing Tessera, a Graphite Frontend

    Et encore 1!

    via arnaudb

    July 23, 2014 at 1:22:24 PM GMT+2 - permalink - archive.org - http://urbanairship.com/blog/2014/06/30/introducing-tessera-a-graphite-frontend
    frontend graphite
  • Live pixel check
    July 22, 2014 at 9:24:32 PM GMT+2 - permalink - archive.org - http://www.websitedimensions.com/pixel/
    css HTML pixel
  • How to rename all folders and files to lowercase on Linux? - Stack Overflow

    Merci à ce mec, il m'a fait gagner du temps ^^

    find my_root_dir -depth -exec rename 's/(.)\/([^\/])/$1\/\L$2/' {} \;

    July 22, 2014 at 4:59:27 PM GMT+2 - permalink - archive.org - http://stackoverflow.com/questions/152514/how-to-rename-all-folders-and-files-to-lowercase-on-linux
    linux lowercase rename
  • StackOverflow Update: 560M Pageviews a Month, 25 Servers, and It's All About Performance - High Scalability -

    infra StackOverflow

    July 22, 2014 at 2:36:02 PM GMT+2 - permalink - archive.org - http://highscalability.com/blog/2014/7/21/stackoverflow-update-560m-pageviews-a-month-25-servers-and-i.html
    devops sys
  • Understanding StatsD and Graphite - pkhamre.blog

    bon article

    July 22, 2014 at 2:10:32 PM GMT+2 - permalink - archive.org - http://blog.pkhamre.com/2012/07/24/understanding-statsd-and-graphite/
    graphite statsd
  • Question #54887 : Questions : Graphite

    In order to save graphs under 'My Graphs' and 'User Graphs' you simply need to log into Graphite and the Save/Delete buttons will then appear on the top of the Composer window. To log in you need to either create an account for yourself in the Django database or setup LDAP authentication. LDAP authentication is setup through local_settings.py, check out the example file's comments for details on doing that (or just ask if you run into any issues). However if you're not using LDAP its pretty easy to create a local user in Django's database using the Django admin interface.

    When you first installed Graphite there was a step where you had to initialize the database by running 'manage.py syncdb'. That prompted you to create an admin user, if you did that already you're good to go. Otherwise you need to create an admin user by running 'manage.py createsuperuser'.

    Once your admin user is setup you can go to the django admin interface by visiting http://my-graphite-server/admin/ (note: the trailing slash is required!) and logging in as your admin user. From there you need to create a new user account by clicking 'Add' under the 'Users' section. After that, go back to the main Graphite page. You may need to logout if it thinks you're still the admin user. Then log back in as you're new user and you should be able to save graphs! Also once logged in you have the ability to set profile options. Currently there is only 1 option, the "advanced UI features" option. Enabling that puts a '*' element in every folder that has more than one element, making it easier to use wildcards when you build graphs.

    Hope that helps.

    July 22, 2014 at 1:26:29 PM GMT+2 - permalink - archive.org - https://answers.launchpad.net/graphite/+question/54887
    admin graphite
  • obfuscurity. - Unhelpful Graphite Tip #8 - Dump your Whisper Metrics
    July 21, 2014 at 5:56:46 PM GMT+2 - permalink - archive.org - http://obfuscurity.com/2012/04/Unhelpful-Graphite-Tip-8
    carbon dump graphite
  • Percona XtraDB Cluster 5.6, HAProxy and Debian Wheezy 7.0
    July 21, 2014 at 5:02:09 PM GMT+2 - permalink - archive.org - http://www.mikemead.me/blog/percona-xtradb-cluster-debian-wheezy
    cluster haproxy mysql
  • thumbnail
    https://github.com/NetSPI/sshkey-grab

    Bon ce code n'a pas marché chez moi... mais il faut bien garder en tête qu'une clé chargée avec un agent va résider en mémoire de manière non chiffrée ;)

    Et de la même manière, elle va résider en mémoire sur un hôte distant si on se connecte en 'ssh -A'. Donc potentiellement, quelqu'un qui a un accès root sur cette machine distante peut récupérer les clés privés des gens qui s'y connectent (en -A)

    github link via skunnyk

    July 21, 2014 at 4:16:55 PM GMT+2 - permalink - archive.org - https://github.com/NetSPI/sshkey-grab
    key security ssh
  • Adding a directory to subversion, and ignoring the directory contents | Metal Toad

    Add the directory, while ignoring all of the files it contains:
    svn add -N [directory]

    After adding the directory enter the directory and run the following command:
    svn propset svn:ignore '*.*' .
    
    Commit your changes:
    svn commit -m "Added the directory and set the files within it to be ignored"
    July 21, 2014 at 12:06:36 PM GMT+2 - permalink - archive.org - http://www.metaltoad.com/blog/adding-directory-subversion-and-ignoring-directory-contents
    svn
  • A Guide to Ruby Collections III: Enumerable and Enumerator
    July 19, 2014 at 5:54:24 PM GMT+2 - permalink - archive.org - http://www.sitepoint.com/guide-ruby-collections-iii-enumerable-enumerator/
    enumerable ruby
  • %Q, %q, %W, %w, %x, %r, %s | Simple Ruby on Rails
    July 19, 2014 at 5:54:01 PM GMT+2 - permalink - archive.org - http://simpleror.wordpress.com/2009/03/15/q-q-w-w-x-r-s/
    ruby
  • Ruby QuickRef | zenspider.com by ryan davis

    quelques bonnes bases

    July 19, 2014 at 5:20:16 PM GMT+2 - permalink - archive.org - http://www.zenspider.com/Languages/Ruby/QuickRef.html#4
    ruby
  • 9% of French Internet Subscribers Accused of Piracy http://feedproxy.google.com/~r/Torrentfreak/~3/hXKiU3gCKVs/
    July 18, 2014 at 8:07:55 PM GMT+2 - permalink - archive.org - http://9% of French Internet Subscribers Accused of Piracy http://feedproxy.google.com/~r/Torrentfreak/~3/hXKiU3gCKVs/
    Hadopi
  • Nginx modules by flavour
    July 18, 2014 at 3:36:32 PM GMT+2 - permalink - archive.org - https://docs.google.com/spreadsheet/ccc?key=0AjuNPnOoex7SdG5fUkhfc3BCSjJQbVVrQTg4UGU2YVE#gid=0
    dotdeb module nginx
  • Brush up on your French with this Bastille Day flowchart - LA Times

    ce serait plus simple avec tu partout

    via sebsauvage

    July 18, 2014 at 10:11:19 AM GMT+2 - permalink - archive.org - http://www.latimes.com/opinion/op-ed/la-og-bastile-vous-tu-20140711-htmlstory.html
    tu vous
  • totp [sebsauvage]

    HMAC-based One-time Password : pour se faire l'équivalent d'un token rsa (genre securid) soi-même en utilisant son smartphone, c'est top et facile à mettre en place :)

    July 18, 2014 at 9:36:50 AM GMT+2 - permalink - archive.org - http://sebsauvage.net/wiki/doku.php?id=totp&#codiad
    auth login otp security
  • ▶ dotScale 2014 - Robert Kennedy - Life in the Trenches of healthcare.gov - YouTube

    nice conf

    July 17, 2014 at 5:53:20 PM GMT+2 - permalink - archive.org - https://www.youtube.com/watch?v=GLQyj-kBRdo&list=PLMW8Xq7bXrG4pl13YVsKkaAUDeLdnrEQZ&index=14
    conf dotscale
Links per page: 20 50 100
◄Older
page 101 / 217
Newer►
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Help/documentation