Skip to content

Instantly share code, notes, and snippets.

View benibela's full-sized avatar

Benito van der Zander benibela

View GitHub Profile
@benibela
benibela / format-integer
Created March 14, 2016 00:30
Xidel can output large numbers, e.g.: format-integer(x:product(1 to 100000), "w")
This file has been truncated, but you can view the full file.
two duoquinquagintacentillinonagintacentillion eight hundred twenty-four duoquinquagintacentillinovemoctogintacentillion two hundred twenty-nine duoquinquagintacentillioctooctogintacentillion four hundred seven duoquinquagintacentilliseptemoctogintacentillion nine hundred sixty duoquinquagintacentillisexoctogintacentillion three hundred forty-seven duoquinquagintacentilliquinquaoctogintacentillion eight hundred seventy-four duoquinquagintacentilliquattoroctogintacentillion two hundred ninety-three duoquinquagintacentillitresoctogintacentillion four hundred twenty-one duoquinquagintacentilliduooctogintacentillion five hundred seventy-eight duoquinquagintacentilliunoctogintacentillion twenty-four duoquinquagintacentillioctogintacentillion five hundred thirty-five duoquinquagintacentillinovenseptuagintacentillion five hundred eighteen duoquinquagintacentillioctoseptuagintacentillion four hundred seventy-seven duoquinquagintacentilliseptenseptuagintacentillion four hundred ninety-four duoquinquagintacentillisesep
@benibela
benibela / bisect.sh
Created December 3, 2017 16:14
FPC/SVN bisection script
#!/bin/bash
testpath=/tmp/fpctest
records=$testpath/records
testsh=$testpath/testrevision.sh
while true; do
oldestfail=$(grep failed $records | grep -oE '^[0-9]+' | sort -n | head -1)
newestok=$(grep ok $records | grep -oE '^[0-9]+' | sort -n | tail -1)
((x=$oldestfail - $newestok))
5000 books
original:
I/VideLibri(22821): 2018-08-11:14:50:40:259 (1074753876): TESTING TIME: 9174
I/VideLibri(22821): 2018-08-11:14:50:56:704 (1074753876): TESTING TIME: 8211
I/VideLibri(22821): 2018-08-11:14:50:48:491 (1074753876): TESTING TIME: 8231
I/VideLibri(22821): 2018-08-11:14:51:05:039 (1074753876): TESTING TIME: 8335
I/VideLibri(22821): 2018-08-11:14:51:29:757 (1074753876): TESTING TIME: 8252
@benibela
benibela / benchmark.lpr
Created March 28, 2020 21:12
Case vs. hashset benchmark
program benchmark;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, xquery.internals.common, bbutils, bbdebugtools,htmlInformation, SysUtils
{ you can add units after this };
@benibela
benibela / json-xml.xqm
Last active September 29, 2020 19:22 — forked from joewiz/json-xml.xqm
An implementation of XQuery 3.1's fn:json-to-xml and fn:xml-to-json functions
xquery version "3.1";
(:~
: An implementation of XQuery 3.1"s fn:json-to-xml and fn:xml-to-json functions for eXist, which does not support them natively as of 4.3.0, and Xidel.
:
: @author Joe Wicentowski, Benito van der Zander
: @version 0.6
: @see http://www.w3.org/TR/xpath-functions-31/#json
:)
module namespace jx = "http://joewiz.org/ns/xquery/json-xml";
@benibela
benibela / makeall.sh
Created October 25, 2020 16:40
How to install FreePascal
#!/bin/bash
#fpcmake -Tall
if [ -f /usr/lib/fpc/3.0.4/ppcx64 ]; then localpath=/usr/lib/fpc/3.0.4;
else if [ -f /usr/local/lib/fpc/3.0.4/ppcx64 ]; then localpath=/usr/local/lib/fpc/3.0.4;
else if [ -f /usr/lib64/fpc/3.0.4/ppcx64 ]; then localpath=/usr/lib64/fpc/3.0.4;
else if [ -f /usr/local/lib64/fpc/3.0.4/ppcx64 ]; then localpath=/usr/local/lib64/fpc/3.0.4;
else if [ -f /usr/lib/fpc/3.0.0/ppcx64 ]; then localpath=/usr/lib/fpc/3.0.0;
else if [ -f /usr/local/lib/fpc/3.0.0/ppcx64 ]; then localpath=/usr/local/lib/fpc/3.0.0;
@benibela
benibela / gist:6a6ce144c8f1ecbc6ea86e55bb766a62
Last active August 30, 2021 13:16
test if json in a diff has changed or not
(:input file:
+json := ...
-json := ...
+json2 := ...
-json2 := ...
:)
xidel patch.diff -e '
let $l := x:lines($raw)
let $del := $l[starts-with(., "-") and not(starts-with(., "---"))]
let $add := $l[starts-with(., "+") and not(starts-with(., "+++"))]