Skip to content

Instantly share code, notes, and snippets.

<?php
function computeInternetChecksum($in) {
// Add an empty char (8-bit).
// This trick leverages the way unpack() works.
$in .= "\x0";
// The n* format splits up the data string into 16-bit pairs.
// It will unpack the string from the beginning, and only split
// whole pairs. So it will automatically leave out (or include) the
langcode: en
status: true
dependencies:
config:
- search_api.server.gendev
- core.entity_view_mode.node.search_index
module:
- node
- search_api
id: gendev
@BirkAndMe
BirkAndMe / ping.c
Created May 3, 2022 07:28
The original ping.c, from http://ftp.arl.army.mil/pub/ping.shar (not there anymore).
/*
* P I N G . C
*
* Using the InterNet Control Message Protocol (ICMP) "ECHO" facility,
* measure round-trip-delays and packet loss across network paths.
*
* Author -
* Mike Muuss
* U. S. Army Ballistic Research Laboratory
* December, 1983