Skip to content

Instantly share code, notes, and snippets.

View AlttiRi's full-sized avatar
💭
{surrogate pair}

[Alt'tiRi] AlttiRi

💭
{surrogate pair}
View GitHub Profile
@AlttiRi
AlttiRi / ByteString.md
Last active December 26, 2022 10:48
Binary strings, ByteString [JavaScript]

Binary strings

JavaScript strings are UTF-16 encoded strings. This means that each code unit requires two bytes of memory and is able to represent 65535 different code points. A subset of these strings is represented by UTF-16 strings containing only ASCII characters (i.e., characters whose code point does not exceed 127). For instance, the string "Hello world!" belongs to the ASCII subset, while the string "ÀÈÌÒÙ" does not. A binary string is a concept similar to the ASCII subset, but instead of limiting the range to 127, it allows code points until 255. Its purpose however is not to represent characters, but binary data. The size of the data so represented is twice as big as it would be in normal binary format, however this will not be visible to the final user, since the length of JavaScript strings is calculated using two bytes as the unit.

Binary st

@MidSpike
MidSpike / readme.md
Last active February 5, 2024 18:09
CVE-2022-23812 | RIAEvangelist/node-ipc is malware / protest-ware
@AlttiRi
AlttiRi / bytesToSizeWinLike.md
Last active October 19, 2023 04:42
How to format file size bytes into the human readable form like it Windows Explorer does.

How to format file size bytes into the human readable form like it Windows Explorer does

...like it Windows Explorer does.

JavaScript code:

/**
 * Formats bytes mostly like Windows does,
 * but in some rare cases the result is different.
@tommyettinger
tommyettinger / mulberry32.c
Last active February 5, 2024 20:32
Mulberry32 PRNG
/* Written in 2017 by Tommy Ettinger (tommy.ettinger@gmail.com)
To the extent possible under law, the author has dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
See <http://creativecommons.org/publicdomain/zero/1.0/>. */
#include <stdint.h>
@slacker
slacker / hotslogs-anti-adblock.user.js
Last active August 1, 2017 13:05
A Greasemonkey script for allowing AdBlock/uBlock on HotsLogs
// ==UserScript==
// @name Hotslogs Bypass
// @version 1.3
// @description Stops redirects
// @author https://github.com/slacker
// @match https://www.hotslogs.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
@nicoulaj
nicoulaj / pom.xml
Created May 4, 2013 11:07
Using JMH in a Maven project.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- Benchmark code goes into src/test/java -->
<dependencies>
<dependency>