Skip to content

Instantly share code, notes, and snippets.

@lbe
lbe / main.go
Last active March 15, 2024 20:11
Go demo code lazy initialization with sync.OnceValue
/*
This code is released under the MIT license - https://opensource.org/license/mit
*/
package main
import (
"database/sql"
"log"
"sync"
#!/usr/bin/env perl
use Mojolicious::Lite -signatures;
use Mojo::File;
use Mojo::Util qw(getopt);
use Pod::Usage;
use version 0.77;
my $VERSION = "0.01";
@lbe
lbe / PKGBUILD
Created December 17, 2022 19:35
ARCH Linux xrdp 0.9.21.1 PKGBUILD
# Maintainer: Brian Bidulock <bidulock@openss7.org>
# Contributo: Jianhui Z <jianhui@outlook.com>
# Contributo: Tau Tsao <realturner at gmail.com>
# Contributor: Tomasz Zok <tomasz.zok [at] gmail.com>
# Contributor: techryda <techryda at silentdome dot com>
# Contributor: Mathias R. <pu154r@overlinux.org>
pkgname=xrdp
pkgver=0.9.21.1
pkgrel=3
@lbe
lbe / popcount.c
Last active August 14, 2022 07:54
sqlite3 extension to calculate the bit population - not working!
/* compile osx
* gcc -bundle -fPIC -O3 -o popcount.dylib popcount.c
* */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sqlite3ext.h>
SQLITE_EXTENSION_INIT1
Macos Montery 12.2 on a 2018 Macbook Pro with a 6 Core I9, perl 5.34
In this case, all three runs resulted in a consistent sequence. Earlier runs resulted in _signature_scalar,
_array_unpack and _ref_direct having differen orders in some runs giving how little difference there is the
performance of each of these.
Rate _ref_unpack _ref_shift _signatures_array _signatures_ref _array_shift _ref_direct _array_unpack _signatures_scalar _array_direct
_ref_unpack 6720430/s -- -0% -8% -12% -16% -25% -27% -29% -65%
_ref_shift 6743088/s 0% -- -8% -12% -15% -25% -27% -29% -65%
_signatures_array 7309942/s 9% 8% -- -4% -8% -19% -21% -23% -62%
#!/usr/bin/env perl
#
use strict;
use warnings;
use feature 'signatures';
no warnings 'experimental::signatures';
use Benchmark qw( cmpthese );
my $first = 1;
@lbe
lbe / app.component.html
Created January 18, 2019 04:25
ngx-echarts renderItem-issue-166-example
<div style="text-align:center">
<h1>
Gizmo Viewer
</h1>
</div>
<div echarts [options]="options" class="chart"></div>
@lbe
lbe / temp.log
Created April 16, 2018 19:18
Logger output for metacpan-client Issue 99
This file has been truncated, but you can view the full file.
GET https://clientinfo.metacpan.org
.---------------------------------+--------------------.
| Request (before sending) Header | Value |
+---------------------------------+--------------------+
| Accept-Encoding | gzip |
| User-Agent | WWW-Mechanize/1.84 |
'---------------------------------+--------------------'
.--------------------------------+--------------------.
jdoe@jdoe-mbp{~}:rperl -v
Running Mkbootstrap for eval_10_b4b2 ()
chmod 644 "eval_10_b4b2.bs"
"/Users/jdoe/perl5/perlbrew/perls/22.3t/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- eval_10_b4b2.bs blib/arch/auto/eval_10_b4b2/eval_10_b4b2.bs 644
"/Users/jdoe/perl5/perlbrew/perls/22.3t/bin/perl" "/Users/jdoe/perl5/perlbrew/perls/22.3t/lib/5.22.3/ExtUtils/xsubpp" -typemap "/Users/jdoe/perl5/perlbrew/perls/22.3t/lib/5.22.3/ExtUtils/typemap" -typemap "/Users/jdoe/.perlbrew/libs/22.3t@std/lib/perl5/typemap.rperl" eval_10_b4b2.xs > eval_10_b4b2.xsc
mv eval_10_b4b2.xsc eval_10_b4b2.c
g++ -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -xc++ -c -I"/Users/jdoe/.perlbrew/libs/22.3t@std/bin" -I/Users/jdoe/.perlbrew/libs/22.3t@std/lib/perl5 -Ilib -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -Wno-unused-variable -DNO_XSLOCKS -Wno-deprecated -std=c++11 -Wno-reserved-
jdoe@jdoe-mbp{~}:rperl
Running Mkbootstrap for eval_10_b4b2 ()
chmod 644 "eval_10_b4b2.bs"
"/Users/jdoe/perl5/perlbrew/perls/22.3t/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- eval_10_b4b2.bs blib/arch/auto/eval_10_b4b2/eval_10_b4b2.bs 644
"/Users/jdoe/perl5/perlbrew/perls/22.3t/bin/perl" "/Users/jdoe/perl5/perlbrew/perls/22.3t/lib/5.22.3/ExtUtils/xsubpp" -typemap "/Users/jdoe/perl5/perlbrew/perls/22.3t/lib/5.22.3/ExtUtils/typemap" -typemap "/Users/jdoe/.perlbrew/libs/22.3t@std/lib/perl5/typemap.rperl" eval_10_b4b2.xs > eval_10_b4b2.xsc
mv eval_10_b4b2.xsc eval_10_b4b2.c
g++ -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -xc++ -c -I"/Users/jdoe/.perlbrew/libs/22.3t@std/bin" -I/Users/jdoe/.perlbrew/libs/22.3t@std/lib/perl5 -Ilib -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -Wno-unused-variable -DNO_XSLOCKS -Wno-deprecated -std=c++11 -Wno-reserved-use