A trivial int-to-hex converter
275
public static void main(String[] args) {
    System.err.println(toString(new int[] { Integer.parseInt(args[0]) }));
  }
1124812
def int_to_padded_hex_byte(integer):
    
    to_hex = hex(integer)
    xpos = to_hex.find('x')
    hex_byte = to_hex[xpos+1 : len(to_hex)].upper()

    if len(hex_byte) == 1:
        hex_byte = ''.join(['0', hex_byte])

    return hex_byte
617090
function hexToBytes(hex) {
    var arr = new Uint8Array(Math.ceil(hex.length / 2));
    for (var i = 0; i < arr.length; i++) {
        arr[i] = parseInt(hex.substr(i * 2, 2), 16);
    }
    return arr;
}
744574
function int128le_to_hex(a, b, c, d) {
        var ra = ""
        var t = 0
        var ta = 0
        for (var i = 3; i >= 0; i--) {
            ta = arguments[i]
            t = (ta & 0xFF)
            ta = ta >>> 8
            t = t << 8
            t = t | (ta & 0xFF)
            ta = ta >>> 8
            t = t << 8
            t = t | (ta & 0xFF)
            ta = ta >>> 8
            t = t << 8
            t = t | ta
            ra = ra + to_zerofilled_hex(t)
        }
        return ra
    }
300640
function (ints) {
    var ret = '0x'
    for (var i = 0; i < ints.length; i++) {
      var h = ints[i]
      if (h) {
        ret += (h <= 0xf ? '0' : '') + h.toString(16)
      } else {
        ret += '00'
      }
    }
    return ret
  }
422815
def num_to_var_int(x):
    
    x = int(x)
    if x < 253:
        return from_int_to_byte(x)

    elif x < 65536:
        return from_int_to_byte(253) + encode(x, 256, 2)[::-1]

    elif x < 4294967296:
        return from_int_to_byte(254) + encode(x, 256, 4)[::-1]

    else:
        return from_int_to_byte(255) + encode(x, 256, 8)[::-1]
360997
def _unpack_int_base128(varint, offset):
        """"""
        res = ord(varint[offset])
        if ord(varint[offset]) >= 0x80:
            offset += 1
            res = ((res - 0x80) << 7) + ord(varint[offset])
            if ord(varint[offset]) >= 0x80:
                offset += 1
                res = ((res - 0x80) << 7) + ord(varint[offset])
                if ord(varint[offset]) >= 0x80:
                    offset += 1
                    res = ((res - 0x80) << 7) + ord(varint[offset])
                    if ord(varint[offset]) >= 0x80:
                        offset += 1
                        res = ((res - 0x80) << 7) + ord(varint[offset])
        return res, offset + 1
955889
function littleEndianToInt8(data, offset)
{
	var x = littleEndianToUint8(data, offset)
	if (x & 0x80) x = x - 256
	return x
}
1288299
function toHex(value) {
  value = Math.round(value);
  value = value.toString(16);
  if (value.length === 1) {
    value = '0' + value;
  }
  return value;
}
880687
def from_hex(cls, value):
        """"""
        if len(value) == 8:
            return cls(int(value, 16))
        elif len(value) == 32:
            return cls(int(value, 16))
        else:
            raise ValueError('%r: invalid hexadecimal notation' % (value,))
529465
def int_to_hex(i):
    
    s = hex(i)[2:].upper()
    if six.PY2 is True and isinstance(i, long):  # pragma: only py2  # NOQA
        # Strip the "L" suffix, since hex(1L) -> 0x1L.
        # NOTE: Do not convert to int earlier. int(<very-large-long>) is still long
        s = s[:-1]
    return add_colons(s)
1006965
function(hex) {
      var pow, result;
      result = 0;
      pow = 0;
      while (hex.length > 0) {
        result += parseInt(hex.substring(0, 2), 16) * Math.pow(2, pow);
        hex = hex.substring(2, hex.length);
        pow += 8;
      }
      return result;
    }
517589
def _int_size(x):
    """"""
    if -0x80 <= x <= 0x7F:
        return 1
    elif -0x8000 <= x <= 0x7FFF:
        return 2
    elif -0x80000000 <= x <= 0x7FFFFFFF:
        return 4
    elif long(-0x8000000000000000) <= x <= long(0x7FFFFFFFFFFFFFFF):
        return 8
    else:
        raise RuntimeError("Cannot represent value: " + str(x))
366110
def hex2dec(s):
    
    if not isinstance(s, str):
        s = str(s)
    return int(s.upper(), 16)
291438
def crc_ihex(hexstr):
    

    crc = sum(bytearray(binascii.unhexlify(hexstr)))
    crc &= 0xff
    crc = ((~crc + 1) & 0xff)

    return crc
584816
function i2osp(x, len){
  const r = new Uint8Array(len);
  r.forEach( (elem, idx) => {
    const y = 0xFF & (x >> (idx*8));
    r[len - idx - 1] = y;
  });
  return r;
}
895542
function _0xColorToHex(color, convertToStr) {
        var hexColor = tinycolor(color.replace("0x", "#"));
        hexColor._format = "0x";

        if (convertToStr) {
            return hexColor.toString();
        }
        return hexColor;
    }