text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>colour.utilities.common Module — Colour 0.3.5 documentation</title>

    <link rel="stylesheet" href="_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/bootswatch-3.1.0/colour/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" />
    <link rel="stylesheet" href="_static/styles.css" type="text/css" />

    <link rel="top" title="Colour 0.3.5 documentation" href="index.html" />
    <link rel="up" title="colour.utilities Package" href="colour.utilities.html" />
    <link rel="next" title="colour.utilities.data_structures Module" href="colour.utilities.data_structures.html" />
    <link rel="prev" title="colour.utilities.array Module" href="colour.utilities.array.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">

        </button>

          Colour 0.3

colour-science.org

                   Documentation

                           API Reference

                           IPython Notebooks

                           Features

                           Contributing

    « colour.utilities...

    colour.utilities... »

<form class="navbar-form navbar-right" action="search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

colour.utilities.common Module¶

Common Utilities¶

Defines common utilities objects that don’t fall in any specific category.

<tt class="descclassname">colour.utilities.common.</tt><tt class="descname">handle_numpy_errors</tt><big>(</big>**kwargs<big>)</big>[source]¶

Decorator for handling Numpy errors.

<col class="field-name" />
<col class="field-body" />

Parameters:	**kwargs (**) – Keywords arguments.

Return type:	object

References

<colgroup><col class="label" /><col /></colgroup>

[1]	Kienzle, P., Patel, N., & Krycka, J. (2011). refl1d.numpyerrors -
Refl1D v0.6.19 documentation. Retrieved January 30, 2015, from
http://www.reflectometry.org/danse/docs/refl1d/_modules/refl1d/numpyerrors.html

Examples

>>> import numpy
>>> @handle_numpy_errors(all='ignore')
... def f():
...     1 / numpy.zeros(3)
>>> f()

<tt class="descclassname">colour.utilities.common.</tt><tt class="descname">ignore_numpy_errors</tt><big>(</big>object<big>)</big>¶

<tt class="descclassname">colour.utilities.common.</tt><tt class="descname">raise_numpy_errors</tt><big>(</big>object<big>)</big>¶

<tt class="descclassname">colour.utilities.common.</tt><tt class="descname">print_numpy_errors</tt><big>(</big>object<big>)</big>¶

<tt class="descclassname">colour.utilities.common.</tt><tt class="descname">warn_numpy_errors</tt><big>(</big>object<big>)</big>¶

<tt class="descclassname">colour.utilities.common.</tt><tt class="descname">ignore_python_warnings</tt><big>(</big>object<big>)</big>[source]¶

Decorator for ignoring Python warnings.

<col class="field-name" />
<col class="field-body" />

Parameters:	object (object) – Object to decorate.

Return type:	object

Examples

>>> @ignore_python_warnings
... def f():
...     warnings.warn('This is an ignored warning!')
>>> f()

<tt class="descclassname">colour.utilities.common.</tt><tt class="descname">batch</tt><big>(</big>iterable, k=3<big>)</big>[source]¶

Returns a batch generator from given iterable.

<col class="field-name" />
<col class="field-body" />

Parameters:

iterable (iterable) – Iterable to create batches from.

k (integer) – Batches size.

Returns:
Is string_like variable.

Return type:
bool

Examples

>>> batch(tuple(range(10)))
<generator object batch at 0x...>

<tt class="descclassname">colour.utilities.common.</tt><tt class="descname">is_openimageio_installed</tt><big>(</big>raise_exception=False<big>)</big>[source]¶

Returns if OpenImageIO is installed and available.

<col class="field-name" />
<col class="field-body" />

Parameters:	raise_exception (bool) – Raise exception if OpenImageIO is unavailable.

Returns:	Is OpenImageIO installed.

Return type:	bool

Raises:	<tt class="xref py py-exc docutils literal">ImportError</tt> –
If OpenImageIO is not installed.

<tt class="descclassname">colour.utilities.common.</tt><tt class="descname">is_scipy_installed</tt><big>(</big>raise_exception=False<big>)</big>[source]¶

Returns if scipy is installed and available.

<col class="field-name" />
<col class="field-body" />

Parameters:	raise_exception (bool) – Raise exception if scipy is unavailable.

Returns:	Is scipy installed.

Return type:	bool

Raises:	<tt class="xref py py-exc docutils literal">ImportError</tt> –
If scipy is not installed.

<tt class="descclassname">colour.utilities.common.</tt><tt class="descname">is_iterable</tt><big>(</big>x<big>)</big>[source]¶

Returns if given \(x\) variable is iterable.

<col class="field-name" />
<col class="field-body" />

Parameters:	x (object) – Variable to check the iterability.

Returns:	\(x\) variable iterability.

Return type:	bool

Examples

>>> is_iterable([1, 2, 3])
True
>>> is_iterable(1)
False

<tt class="descclassname">colour.utilities.common.</tt><tt class="descname">is_string</tt><big>(</big>data<big>)</big>[source]¶

Returns if given data is a string_like variable.

<col class="field-name" />
<col class="field-body" />

Parameters:	data (object) – Data to test.

Returns:	Is string_like variable.

Return type:	bool

Examples

>>> is_string('I`m a string!')
True
>>> is_string(['I`m a string!'])
False

<tt class="descclassname">colour.utilities.common.</tt><tt class="descname">is_numeric</tt><big>(</big>x<big>)</big>[source]¶

Returns if given \(x\) variable is a number.

<col class="field-name" />
<col class="field-body" />

Parameters:	x (object) – Variable to check.

Returns:	Is \(x\) variable a number.

Return type:	bool

See also

<tt class="xref py py-func docutils literal">is_integer()</tt>

Examples

>>> is_numeric(1)
True
>>> is_numeric((1,))
False

<tt class="descclassname">colour.utilities.common.</tt><tt class="descname">is_integer</tt><big>(</big>x<big>)</big>[source]¶

Returns if given \(x\) variable is an integer under given threshold.

<col class="field-name" />
<col class="field-body" />

Parameters:	x (object) – Variable to check.

Returns:	Is \(x\) variable an integer.

Return type:	bool

Notes

The determination threshold is defined by the
<tt class="xref py py-attr docutils literal">colour.algebra.common.INTEGER_THRESHOLD</tt> attribute.

See also

<tt class="xref py py-func docutils literal">is_numeric()</tt>

Examples

>>> is_integer(1)
True
>>> is_integer(1.01)
False

      Back to top

        © Copyright 2013 - 2015, Colour Developers.

      Created using Sphinx 1.2.2.


text:
package io.github.hapjava.characteristics.impl.lock;

import io.github.hapjava.characteristics.CharacteristicEnum;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/** 0 "Unsecured" 1 "Secured" 2 "Jammed" 3 "Unknown" 4-255 "Reserved" */
public enum LockCurrentStateEnum implements CharacteristicEnum {
  UNSECURED(0),
  SECURED(1),
  JAMMED(2),
  UNKNOWN(3);

  private static final Map<Integer, LockCurrentStateEnum> reverse;

  static {
    reverse =
        Arrays.stream(LockCurrentStateEnum.values())
            .collect(Collectors.toMap(LockCurrentStateEnum::getCode, t -> t));
  }

  public static LockCurrentStateEnum fromCode(Integer code) {
    return reverse.get(code);
  }

  private final int code;

  LockCurrentStateEnum(int code) {
    this.code = code;
  }

  @Override
  public int getCode() {
    return code;
  }
}

redpajama_set_name: RedPajamaGithub


text:
/**
 * Created by 385382 on 1/19/2015.
 */
/**
 * Created by 290494 on 8/20/2014.
 */

// Node Modules
var express = require('express'),
    app = express(),
    fs = require('fs'),
    xml2js = require('xml2js');

app.use(express.static(__dirname + '/static'));
// Developed Files

app.get("/start", function(req, res){

    console.log("received for the index page ");
    res.sendfile("./demo.html");

})

var renderer = require('./RenderFile.js');

app.get("/testService", function(req, res){

    console.log("received for the index page ");
    res.send("This is a test data");

})

app.post("/postXml", function (req, res) {

    var body = "";
    req.on('data', function (data) {
        body += data;
    });
    req.on('end', function () {
        //console.log("info", body);
        var postData = body;
        console.log("request received " + postData)
        //res.send(postData);
        xml2js.parseString(postData, function(err, result){
            //res.send(result);
            console.log("result " + JSON.stringify(result));
            new renderer().renderString(postData, req, res);
        });

        //new renderer().renderString(postData, req, res);

    });
});

app.get("/uploadLink", function (req, res) {
    winston.log("info", "request received ")
    //var responseHTML = '<title>upload</title><formaction="http://www.google.com"enctype="multipart/form-data"method="GET"><inputtype="file"name="upload">
<inputtype="submit"value="upload"></form>';
    //res.setHeader("Content-Type", "text/html");
    res.sendfile('./Upload.html');
})

app.listen(5858);


text:
int main(int argc, char** argv)
{
    rclcpp::init(argc, argv);

    auto node = rclcpp::create_node("talker");

    auto publisher = node->create_publisher<std_msgs::String>("chatter", 0);

    std_msgs::String msg;
    int count = 0;
    while(node->is_running())
    {
        std::stringstream ss;
        ss << "[" << count++ << "]: Hello World!";
        msg.data = ss.str();
        publisher->publish(msg);
        sleep(1);
    }
}


text:
title: "Day 1 Saarang"
layout: "post"
#permalink: "/2012/01/day-1-saarang.html"
uuid: "2569816959240267774"
guid: "tag:blogger.com,1999:blog-3395442647519481452.post-2569816959240267774"
date: "2012-01-20 13:22:00"
updated: "2012-01-20 13:22:29"
description:
blogger:
    siteid: "3395442647519481452"
    postid: "2569816959240267774"
    comments: "0"
categories:
author:
    name: "Junaid Babu"
    url: "https://plus.google.com/116146697743652867110?rel=author"
    image: "//lh4.googleusercontent.com/-uP3Xzdf9OgU/AAAAAAAAAAI/AAAAAAAAhrI/ir4DgdKnzN0/s512-c/photo.jpg"
---

finally fb is on in insti. Saarang going on so smooth!! All the events are so awesome. Ah its obv! As usual, I couldnt find anything interesting. Found those blogs are so interesting. Their life also may be so.. So sleepy all the time. Coudnt just sleep also. And my parents want to come to insti. No way this month!!

One this great was the dance workshop. But being incomplete, there us nothing to so with me. May be next year Im also gonna do something great. Time has changed the strand. Lost all its property!! Insti life is damn different now!!!


text:
#define CATCH_CONFIG_MAIN
#include "catch2/catch.hpp"

#include <iostream>
#include <memory>

#include "lluvia/core.h"
#include "lluvia/core/vulkan/Instance.h"

TEST_CASE("create_instance", "test_Instance")
{

    {
        auto instance = std::make_unique<ll::vulkan::Instance>(false);

        REQUIRE(instance != nullptr);
    }

    std::cout << "test_instance: finish" << std::endl;
}

TEST_CASE("create_instance_with_debug", "test_Instance")
{

    auto instance = std::unique_ptr<ll::vulkan::Instance> {nullptr};

    // create instance with debug enabled
    REQUIRE_NOTHROW(instance = std::make_unique<ll::vulkan::Instance>(true));
    REQUIRE(instance != nullptr);

    REQUIRE_FALSE(instance->hasReceivedVulkanWarningMessages());
}


text:
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { itemsFetchData } from '../actions/items';

class ItemList extends Component {
  constructor() {
    super();
    this.state = {
      items: [],
      hasErrored: false,
      isLoading: false
    };
  }

  componentDidMount() {
    this.fetchData('http://5826ed963900d612000138bd.mockapi.io/items');
  }

  fetchData(url) {
    this.setState({ isLoading: true });

    fetch(url)
      .then(response => {
        if(!response.ok) {
          throw Error(response.statusText);
        }

        this.setState({ isLoading: false });

        return response;
      })
        .then(response => response.json())
        .then(items => this.setState({ items }))
        .catch(() => this.setState({ hasErrored: true }));
  }

  render() {
    if (this.state.hasErrored) {
      return
Sorry! There was an error loading the items
;
    }
    if (this.state.isLoading) {
      return
Loading…
;
    }
    return (

        {this.state.items.map((item) => (

            {item.label}

         ))}

    );
  }
}

export default ItemList;


text:
<!doctype html>

    <meta charset="utf-8">
    <title>Microsoft Player Framework Samples - PlayReady</title>

    <link href="playready.css" rel="stylesheet" />

            <button id="backButton" data-win-control="WinJS.UI.BackButton"></button>

                <fieldset class="log">
                    <legend>Log</legend>

                </fieldset>


text:
package org.ethereum.net.wire;

import org.ethereum.listener.EthereumListener;
import org.ethereum.manager.WorldManager;
import org.ethereum.net.message.Message;
import org.ethereum.net.message.MessageFactory;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.spongycastle.util.encoders.Hex;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * The PacketDecoder parses every valid Ethereum packet to a Message object
 */
@Component
@Scope("prototype")
public class MessageDecoder extends ByteToMessageDecoder {

    private static final Logger loggerWire = LoggerFactory.getLogger("wire");
    private static final Logger loggerNet = LoggerFactory.getLogger("net");

    @Autowired
    WorldManager worldManager;

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {

        if (!isValidEthereumPacket(in)) {
            return;
        }

        byte[] encoded = new byte[in.readInt()];
        in.readBytes(encoded);

        if (loggerWire.isDebugEnabled())
            loggerWire.debug("Encoded: [{}]", Hex.toHexString(encoded));

        Message msg = MessageFactory.createMessage(encoded);

        if (loggerNet.isInfoEnabled())
            loggerNet.info("From: \t{} \tRecv: \t{}", ctx.channel().remoteAddress(), msg);

        EthereumListener listener = worldManager.getListener();
        listener.onRecvMessage(msg);

        out.add(msg);
        in.markReaderIndex();
    }

    private boolean isValidEthereumPacket(ByteBuf in) {
        // Ethereum message is at least 8 bytes
        if (in.readableBytes() < 8)
            return false;

        long syncToken = in.readUnsignedInt();

        if (!((syncToken >> 24 & 0xFF) == 0x22 &&
                (syncToken >> 16 & 0xFF) == 0x40 &&
                (syncToken >> 8 & 0xFF) == 0x08 &&
                (syncToken & 0xFF) == 0x91)) {

            // TODO: Drop frame and continue.
            // A collision can happen (although rare)
            // If this happens too often, it's an attack.
            // In that case, drop the peer.
            loggerWire.error("Abandon garbage, wrong sync token: [{}]", syncToken);
        }

        // Don't have the full message yet
        long msgSize = in.getInt(in.readerIndex());
        if (msgSize > in.readableBytes()) {
            loggerWire.trace("msg decode: magicBytes: [{}], readBytes: [{}] / msgSize: [{}] ",
                    syncToken, in.readableBytes(), msgSize);
            in.resetReaderIndex();
            return false;
        }

        loggerWire.trace("Message fully constructed: readBytes: [{}] / msgSize: [{}]", in.readableBytes(), msgSize);
        return true;
    }
}


text:
""" MP4 Parser based on:
http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf

@author: Alastair McCormack
@license: MIT License

"""

import bitstring
from datetime import datetime
from collections import namedtuple
import logging
import six

log = logging.getLogger(__name__)
#log.addHandler(logging.NullHandler())
log.setLevel(logging.WARN)

class MixinDictRepr(object):
    def __repr__(self, *args, **kwargs):
        return "{class_name} : {content!r} ".format(class_name=self.__class__.__name__,
                                                    content=self.__dict__)

class MixinMinimalRepr(object):
    """ A minimal representaion when the payload could be large """

    def __repr__(self, *args, **kwargs):
        return "{class_name} : {content!r} ".format(class_name=self.__class__.__name__,
                                                    content=self.__dict__.keys())

class FragmentRunTableBox(MixinDictRepr):
    pass

class UnImplementedBox(MixinDictRepr):
    type = "na"
    pass

class MovieFragmentBox(MixinDictRepr):
    type = "moof"

class BootStrapInfoBox(MixinDictRepr):
    type = "abst"

    @property
    def current_media_time(self):
        return self._current_media_time

    @current_media_time.setter
    def current_media_time(self, epoch_timestamp):
        """ Takes a timestamp arg and saves it as datetime """
        self._current_media_time = datetime.utcfromtimestamp(epoch_timestamp/float(self.time_scale))

class FragmentRandomAccessBox(MixinDictRepr):
    """ aka afra """
    type = "afra"

    FragmentRandomAccessBoxEntry = namedtuple("FragmentRandomAccessBoxEntry", ["time", "offset"])
    FragmentRandomAccessBoxGlobalEntry = namedtuple("FragmentRandomAccessBoxGlobalEntry", ["time", "segment_number", "fragment_number", "afra_offset", "sample_offset"])

    pass

class SegmentRunTable(MixinDictRepr):
    type = "asrt"

    SegmentRunTableEntry = namedtuple('SegmentRunTableEntry', ["first_segment", "fragments_per_segment"])
    pass

class FragmentRunTable(MixinDictRepr):
    type = "afrt"

    class FragmentRunTableEntry( namedtuple('FragmentRunTableEntry',
                                       ["first_fragment",
                                        "first_fragment_timestamp",
                                        "fragment_duration",
                                        "discontinuity_indicator"]) ):

        DI_END_OF_PRESENTATION = 0
        DI_NUMBERING = 1
        DI_TIMESTAMP = 2
        DI_TIMESTAMP_AND_NUMBER = 3

        def __eq__(self, other):
            if self.first_fragment == other.first_fragment and \
                self.first_fragment_timestamp == other.first_fragment_timestamp and \
                self.fragment_duration == other.fragment_duration and \
                self.discontinuity_indicator == other.discontinuity_indicator:
                    return True

    def __repr__(self, *args, **kwargs):
        return str(self.__dict__)

class MediaDataBox(MixinMinimalRepr):
    """ aka mdat """
    type = "mdat"

class MovieFragmentHeader(MixinDictRepr):
    type = "mfhd"

class ProtectionSystemSpecificHeader(MixinDictRepr):
    type = "pssh"

BoxHeader = namedtuple( "BoxHeader", ["box_size", "box_type", "header_size"] )

class F4VParser(object):

    @classmethod
    def parse(cls, filename=None, bytes_input=None, file_input=None, offset_bytes=0, headers_only=False):
        """
        Parse an MP4 file or bytes into boxes

        :param filename: filename of mp4 file.
        :type filename: str.
        :param bytes_input: bytes of mp4 file.
        :type bytes_input: bytes / Python 2.x str.
        :param offset_bytes: start parsing at offset.
        :type offset_bytes: int.
        :param headers_only: Ignore data and return just headers. Useful when data is cut short
        :type: headers_only: boolean
        :return: BMFF Boxes or Headers

        """

        box_lookup = {
            BootStrapInfoBox.type:                  cls._parse_abst,
            FragmentRandomAccessBox.type:           cls._parse_afra,
            MediaDataBox.type:                      cls._parse_mdat,
            MovieFragmentBox.type:                  cls._parse_moof,
            MovieFragmentHeader.type:               cls._parse_mfhd,
            ProtectionSystemSpecificHeader.type:    cls._parse_pssh
        }

        if filename:
            bs = bitstring.ConstBitStream(filename=filename, offset=offset_bytes * 8)
        elif bytes_input:
            bs = bitstring.ConstBitStream(bytes=bytes_input, offset=offset_bytes * 8)
        else:
            bs = bitstring.ConstBitStream(auto=file_input, offset=offset_bytes * 8)

        log.debug("Starting parse")
        log.debug("Size is %d bits", bs.len)

        while bs.pos < bs.len:
            log.debug("Byte pos before header: %d relative to (%d)", bs.bytepos, offset_bytes)
            log.debug("Reading header")
            try:
                header = cls._read_box_header(bs)
            except bitstring.ReadError as e:
                log.error("Premature end of data while reading box header")
                raise

            log.debug("Header type: %s", header.box_type)
            log.debug("Byte pos after header: %d relative to (%d)", bs.bytepos, offset_bytes)

            if headers_only:
                yield header

                # move pointer to next header if possible
                try:
                    bs.bytepos += header.box_size
                except ValueError:
                    log.warning("Premature end of data")
                    raise
            else:
                # Get parser method for header type
                parse_function = box_lookup.get(header.box_type, cls._parse_unimplemented)
                try:
                    yield parse_function(bs, header)
                except ValueError as e:
                    log.error("Premature end of data")
                    raise

    @classmethod
    def _is_mp4(cls, parser):
        try:
            for box in parser:
                return True
        except ValueError:
            return False

    @classmethod
    def is_mp4_s(cls, bytes_input):
        """ Is bytes_input the contents of an MP4 file

        :param bytes_input: str/bytes to check.
        :type bytes_input: str/bytes.
        :return:
        """

        parser = cls.parse(bytes_input=bytes_input, headers_only=True)
        return cls._is_mp4(parser)

    @classmethod
    def is_mp4(cls, file_input):
        """ Checks input if it's an MP4 file

        :param input: Filename or file object
        :type input: str, file
        :param state: Current state to be in.
        :type state: bool.
        :returns:  bool.
        :raises: AttributeError, KeyError
        """

        if hasattr(file_input, "read"):
           parser = cls.parse(file_input=file_input, headers_only=True)
        else:
           parser = cls.parse(filename=file_input, headers_only=True)
        return cls._is_mp4(parser)

    @staticmethod
    def _read_string(bs):
        """ read UTF8 null terminated string """
        result = bs.readto('0x00', bytealigned=True).bytes.decode("utf-8")[:-1]
        return result if result else None

    @classmethod
    def _read_count_and_string_table(cls, bs):
        """ Read a count then return the strings in a list """
        result = []
        entry_count = bs.read("uint:8")
        for _ in six.range(0, entry_count):
            result.append( cls._read_string(bs) )
        return result

    @staticmethod
    def _read_box_header(bs):
        header_start_pos = bs.bytepos
        size, box_type = bs.readlist("uint:32, bytes:4")

        # box_type should be an ASCII string. Decode as UTF-8 in case
        try:
            box_type = box_type.decode('utf-8')
        except UnicodeDecodeError:
            # we'll leave as bytes instead
            pass

        # if size == 1, then this is an extended size type.
        # Therefore read the next 64 bits as size
        if size == 1:
            size = bs.read("uint:64")
        header_end_pos = bs.bytepos
        header_size = header_end_pos - header_start_pos

        return BoxHeader(box_size=size-header_size, box_type=box_type, header_size=header_size)

    @staticmethod
    def _parse_unimplemented(bs, header):
        ui = UnImplementedBox()
        ui.header = header

        bs.bytepos += header.box_size

        return ui

    @classmethod
    def _parse_afra(cls, bs, header):

        afra = FragmentRandomAccessBox()
        afra.header = header

        # read the entire box in case there's padding
        afra_bs = bs.read(header.box_size * 8)
        # skip Version and Flags
        afra_bs.pos += 8 + 24
        long_ids, long_offsets, global_entries, afra.time_scale, local_entry_count  = \
                afra_bs.readlist("bool, bool, bool, pad:5, uint:32, uint:32")

        if long_ids:
            id_bs_type = "uint:32"
        else:
            id_bs_type = "uint:16"

        if long_offsets:
            offset_bs_type = "uint:64"
        else:
            offset_bs_type = "uint:32"

        log.debug("local_access_entries entry count: %s", local_entry_count)
        afra.local_access_entries = []
        for _ in six.range(0, local_entry_count):
            time = cls._parse_time_field(afra_bs, afra.time_scale)

            offset = afra_bs.read(offset_bs_type)

            afra_entry = \
                FragmentRandomAccessBox.FragmentRandomAccessBoxEntry(time=time,
                                                                     offset=offset)
            afra.local_access_entries.append(afra_entry)

        afra.global_access_entries = []

        if global_entries:
            global_entry_count = afra_bs.read("uint:32")

            log.debug("global_access_entries entry count: %s", global_entry_count)

            for _ in six.range(0, global_entry_count):
                time = cls._parse_time_field(afra_bs, afra.time_scale)

                segment_number = afra_bs.read(id_bs_type)
                fragment_number = afra_bs.read(id_bs_type)

                afra_offset = afra_bs.read(offset_bs_type)
                sample_offset = afra_bs.read(offset_bs_type)

                afra_global_entry = \
                    FragmentRandomAccessBox.FragmentRandomAccessBoxGlobalEntry(
                                            time=time,
                                            segment_number=segment_number,
                                            fragment_number=fragment_number,
                                            afra_offset=afra_offset,
                                            sample_offset=sample_offset)

                afra.global_access_entries.append(afra_global_entry)

        return afra

    @classmethod
    def _parse_moof(cls, bootstrap_bs, header):
        moof = MovieFragmentBox()
        moof.header = header

        box_bs = bootstrap_bs.read(moof.header.box_size * 8)

        for child_box in cls.parse(bytes_input=box_bs.bytes):
            setattr(moof, child_box.type, child_box)

        return moof

    @classmethod
    def _parse_mfhd(cls, bootstrap_bs, header):
        mfhd = MovieFragmentHeader()
        mfhd.header = header

        box_bs = bootstrap_bs.read(mfhd.header.box_size * 8)
        return mfhd

    @staticmethod
    def _parse_pssh(bootstrap_bs, header):
        pssh = ProtectionSystemSpecificHeader()
        pssh.header = header

        box_bs = bootstrap_bs.read(pssh.header.box_size * 8)
        # Payload appears to be 8 bytes in.
        pssh.payload = box_bs.bytes[8:]
        return pssh

    @classmethod
    def _parse_abst(cls, bootstrap_bs, header):

        abst = BootStrapInfoBox()
        abst.header = header

        box_bs = bootstrap_bs.read(abst.header.box_size * 8)

        abst.version, abst.profile_raw, abst.live, abst.update, \
        abst.time_scale, abst.current_media_time, abst.smpte_timecode_offset = \
                box_bs.readlist("""pad:8, pad:24, uint:32, uint:2, bool, bool,
                                   pad:4,
                                   uint:32, uint:64, uint:64""")
        abst.movie_identifier = cls._read_string(box_bs)

        abst.server_entry_table = cls._read_count_and_string_table(box_bs)
        abst.quality_entry_table = cls._read_count_and_string_table(box_bs)

        abst.drm_data = cls._read_string(box_bs)
        abst.meta_data = cls._read_string(box_bs)

        abst.segment_run_tables = []

        segment_count = box_bs.read("uint:8")
        log.debug("segment_count: %d" % segment_count)
        for _ in six.range(0, segment_count):
            abst.segment_run_tables.append( cls._parse_asrt(box_bs) )

        abst.fragment_tables = []
        fragment_count = box_bs.read("uint:8")
        log.debug("fragment_count: %d" % fragment_count)
        for _ in xrange(0, fragment_count):
            abst.fragment_tables.append( cls._parse_afrt(box_bs) )

        log.debug("Finished parsing abst")

        return abst

    @classmethod
    def _parse_asrt(cls, box_bs):
        """ Parse asrt / Segment Run Table Box """

        asrt = SegmentRunTable()
        asrt.header = cls._read_box_header(box_bs)
        # read the entire box in case there's padding
        asrt_bs_box = box_bs.read(asrt.header.box_size * 8)

        asrt_bs_box.pos += 8
        update_flag = asrt_bs_box.read("uint:24")
        asrt.update = True if update_flag == 1 else False

        asrt.quality_segment_url_modifiers = cls._read_count_and_string_table(asrt_bs_box)

        asrt.segment_run_table_entries = []
        segment_count = asrt_bs_box.read("uint:32")

        for _ in six.range(0, segment_count):
            first_segment = asrt_bs_box.read("uint:32")
            fragments_per_segment = asrt_bs_box.read("uint:32")
            asrt.segment_run_table_entries.append(
                SegmentRunTable.SegmentRunTableEntry(first_segment=first_segment,
                                                     fragments_per_segment=fragments_per_segment) )
        return asrt

    @classmethod
    def _parse_afrt(cls, box_bs):
        """ Parse afrt / Fragment Run Table Box """

        afrt = FragmentRunTable()
        afrt.header = cls._read_box_header(box_bs)
        # read the entire box in case there's padding
        afrt_bs_box = box_bs.read(afrt.header.box_size * 8)

        afrt_bs_box.pos += 8
        update_flag = afrt_bs_box.read("uint:24")
        afrt.update = True if update_flag == 1 else False

        afrt.time_scale = afrt_bs_box.read("uint:32")
        afrt.quality_fragment_url_modifiers = cls._read_count_and_string_table(afrt_bs_box)

        fragment_count = afrt_bs_box.read("uint:32")

        afrt.fragments = []

        for _ in six.range(0, fragment_count):
            first_fragment = afrt_bs_box.read("uint:32")
            first_fragment_timestamp_raw = afrt_bs_box.read("uint:64")

            try:
                first_fragment_timestamp = datetime.utcfromtimestamp(first_fragment_timestamp_raw/float(afrt.time_scale))
            except ValueError:
                # Elemental sometimes create odd timestamps
                first_fragment_timestamp = None

            fragment_duration = afrt_bs_box.read("uint:32")

            if fragment_duration == 0:
                discontinuity_indicator = afrt_bs_box.read("uint:8")
            else:
                discontinuity_indicator = None

            frte = FragmentRunTable.FragmentRunTableEntry(first_fragment=first_fragment,
                                                          first_fragment_timestamp=first_fragment_timestamp,
                                                          fragment_duration=fragment_duration,
                                                          discontinuity_indicator=discontinuity_indicator)
            afrt.fragments.append(frte)
        return afrt

    @staticmethod
    def _parse_mdat(box_bs, header):
        """ Parse afrt / Fragment Run Table Box """

        mdat = MediaDataBox()
        mdat.header = header
        mdat.payload = box_bs.read(mdat.header.box_size * 8).bytes
        return mdat

    @staticmethod
    def _parse_time_field(bs, scale):
        timestamp = bs.read("uint:64")
        return datetime.utcfromtimestamp(timestamp / float(scale) )


text:
stage: Systems
group: Distribution
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
comments: false
---

# Installing GitLab with Omnibus packages **(FREE SELF)**

## Prerequisites

- [Installation Requirements](https://docs.gitlab.com/ee/install/requirements.html).
- If you want to access your GitLab instance via a domain name, like `mygitlabinstance.com`,
  make sure the domain correctly points to the IP of the server where GitLab is being
  installed. You can check this using the command `host mygitlabinstance.com`.
- If you want to use HTTPS on your GitLab instance, make sure you have the SSL
  certificates for the domain ready. (Note that certain components like
  Container Registry which can have their own subdomains requires certificates for
  those subdomains also.)
- If you want to send notification emails, install and configure a mail server (MTA)
  like Sendmail or Postfix. Alternatively, you can use other [third party SMTP servers](../settings/smtp.md).

## Installation and Configuration

These configuration settings are commonly used when configuring Omnibus GitLab.
For a complete list of settings, see the [README](../index.md#configuring) file.

- [Installing GitLab](https://about.gitlab.com/install/).
  - [Manually downloading and installing a GitLab package](https://docs.gitlab.com/ee/update/package/#upgrade-using-a-manually-downloaded-package).
- [Setting up a domain name/URL](../settings/configuration.md#configure-the-external-url-for-gitlab)
  for the GitLab Instance so that it can be accessed easily.
- [Enabling HTTPS](../settings/nginx.md#enable-https).
- [Enabling notification emails](../settings/smtp.md#smtp-settings).
- [Enabling replying via email](https://docs.gitlab.com/ee/administration/reply_by_email.html#set-it-up).
  - [Installing and configuring Postfix](https://docs.gitlab.com/ee/administration/reply_by_email_postfix_setup.html).
- [Enabling container registry on GitLab](https://docs.gitlab.com/ee/administration/packages/container_registry.html#container-registry-domain-configuration).
  - You require SSL certificates for the domain used for container registry.
- [Enabling GitLab Pages](https://docs.gitlab.com/ee/administration/pages/).
  - If you want HTTPS enabled, you must get wildcard certificates.
- [Enabling Elasticsearch](https://docs.gitlab.com/ee/integration/advanced_search/elasticsearch.html).
- [GitLab Mattermost](https://docs.gitlab.com/ee/integration/mattermost/) Set up the Mattermost messaging app that ships with Omnibus GitLab package.
- [GitLab Prometheus](https://docs.gitlab.com/ee/administration/monitoring/prometheus/index.html)
  Set up the Prometheus monitoring included in the Omnibus GitLab package.
- [GitLab High Availability Roles](../roles/index.md).

### Set up the initial password

> [Introduced](https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/5331) in Omnibus GitLab 14.0.

By default, Omnibus GitLab automatically generates a password for the
initial administrator user account (`root`) and stores it to
`/etc/gitlab/initial_root_password` for at least 24 hours. For security reasons,
after 24 hours, this file is automatically removed by the first `gitlab-ctl reconfigure`.

NOTE:
If GitLab can't detect a valid hostname for the server during the
installation, a reconfigure does not run.

To provide a custom initial root password, you have two options:

- Pass the `GITLAB_ROOT_PASSWORD` environment variable to the
  [installation command](https://about.gitlab.com/install/) provided
  the hostname for the server is set up correctly.
  If during the installation GitLab doesn't automatically perform a
  reconfigure, you have to pass the `GITLAB_ROOT_PASSWORD` variable to the
  first `gitlab-ctl reconfigure` run.
- Before the first reconfigure, edit `/etc/gitlab/gitlab.rb` (create it if it
  doesn't exist) and set:

  ```ruby
  gitlab_rails['initial_root_password'] = '<my_strong_password>'
  ```

Both of these methods apply only during the initial database seeding, which happens
during the first reconfigure. For subsequent reconfigure runs, neither of
the aforementioned methods have any effect. In that case, use the random
password in `/etc/gitlab/initial_root_password` to log in, or
[reset the root password](https://docs.gitlab.com/ee/security/reset_user_password.html).

## Using Docker image

You can also use the Docker images provided by GitLab to install and configure a GitLab instance.
Check the [documentation](https://docs.gitlab.com/ee/install/docker.html) to know more.


text:
{% from "challenges/helpers.html" import created_by with context %}

        {{ entry.title }}

{{ entry.brief_description }}

    <address>{{ created_by(entry, footer=False) }}</address>