This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is now https://github.com/federlieb/federprof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function process_command() { | |
if [ "$$" -eq "$BASHPID" ]; then | |
if [[ "$HANDLER_INSTALLED" -ne "1" ]]; then | |
exec > >( | |
trap "" INT TERM; | |
awk '{ print strftime("%Y-%m-%d %H:%M:%S ", systime()) $0; fflush(stdout) }' | |
) | |
exec 2> >( | |
trap "" INT TERM; | |
awk '{ print strftime("%Y-%m-%d %H:%M:%S ", systime()) $0; fflush(stdout) }' >&2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; FIXME: The grammar has been transformed so that `w` appears after a | |
; token, but there is no way in ABNF to define it as token-separator | |
; that can optionally contain a mix of comments and white-space. Take | |
; `;;` as an example, for that to match `sql-stmt-list` `w` would | |
; have to match the empty string. But if `w` matches the empty string | |
; then `ISNOT` is the same as `IS NOT`. | |
sql-stmt-list = [ sql-stmt ] *( ";" w [ sql-stmt ] ) | |
sql-stmt = [ "EXPLAIN" w [ "QUERY" w "PLAN" w ] ] ( alter-table-stmt / analyze-stmt / attach-stmt / begin-stmt / commit-stmt / create-index-stmt / create-table-stmt / create-trigger-stmt / create-view-stmt / create-virtual-table-stmt / delete-stmt / delete-stmt-limited / detach-stmt / drop-index-stmt / drop-table-stmt / drop-trigger-stmt / drop-view-stmt / insert-stmt / pragma-stmt / reindex-stmt / release-stmt / rollback-stmt / savepoint-stmt / select-stmt / update-stmt / update-stmt-limited / vacuum-stmt ) | |
alter-table-stmt = "ALTER" w "TABLE" w [ schema-name w "." w ] table-na |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use DBI; | |
use JSON; | |
use YAML::XS; | |
my $dbh = DBI->connect('dbi:SQLite:dbname=:memory:'); | |
our $Arg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH | |
bytes AS ( | |
SELECT 0x00 AS byte | |
UNION ALL | |
SELECT byte+1 FROM bytes WHERE byte < 0xFF | |
), | |
base AS ( | |
SELECT 0x0000 AS cp | |
UNION ALL | |
SELECT cp+1 FROM base WHERE cp < 0x10FFFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH | |
args AS ( | |
SELECT | |
' | |
[ | |
[[1,3]], | |
[[3,5],[7,8]], | |
[[8,8]], | |
[[0,100]] | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const through2 = require('through2'); | |
const split2 = require('split2'); | |
var vowels = through2({ objectMode: true }); | |
var consonants = through2({ objectMode: true }); | |
var muxed = through2({ objectMode: true, highWaterMark: 1 }); | |
[vowels, consonants].forEach(x => x.pipe(muxed)); | |
muxed.pipe(process.stderr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export namespace api { | |
export interface Request< | |
> { | |
method: string; | |
params: any; | |
result: any; | |
} | |
export interface Notification< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export namespace api { | |
export interface Request<T extends string> { | |
params: any; | |
result: any; | |
__name: { | |
[name in T]: T | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { spawn } from 'child_process'; | |
import { Writable, Readable } from 'stream'; | |
const child = spawn( | |
'perl', | |
['-e', ` | |
use IO::Handle; | |
my $in = IO::Handle->new_from_fd($ENV{JIPE_RHS_STDIN_FD}, 'r'); | |
my $out = IO::Handle->new_from_fd($ENV{JIPE_RHS_STDOUT_FD}, 'w'); |
NewerOlder