Skip to content

Instantly share code, notes, and snippets.

View stelf's full-sized avatar
🦌
focusing 🦊

Gheorghi stelf

🦌
focusing 🦊
View GitHub Profile
@stelf
stelf / check.interesect.consistency.sql
Created December 4, 2021 00:03
check spatial intersection consistency by making sure no duplicate rows are returned
-- listing only records that appear more than twice
-- in result which finds points within areas
--
-- the partitioning allows us to figure the results
-- alongside corresponding dulplicate areas
--
-- the n.type may be skipped, is included as aexample
select * from (
select
@stelf
stelf / school.data.prep.sh
Last active December 3, 2021 12:15
a short excursion into jq black magic
jq -sc '.[] | .result."attendance-areas"[] | {
type: "Feature",
properties: {
id: .id,
grade: .grade | tostring,
openEnrollment: .openEnrollment,
name: .name, },
geometry: .geometry, }' input/school-page-*.json > prepared/school.geojson
const saxpath = require('./lib/saxpath');
const fs = require('fs');
const zlib = require('zlib');
const sax = require('sax');
const saxParser = sax.createStream(true);
const deflate = zlib.createGunzip();
const fileStream = fs.createReadStream('../discogs_20211101_releases.xml.gz');
const streamer = new saxpath.SaXPath(saxParser, '/releases/release');
#!/usr/local/bin/perl
use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
use XML::XPath;
my $ifile = '/Users/user/Downloads/discogs_20211101_releases.xml.gz';
my $ioref = IO::Uncompress::Gunzip->new( $ifile )
or die "gunzip failed: $GunzipError\n";
my $xp = XML::XPath->new(ioref => $ioref );
@stelf
stelf / dynamic.regex.switch.pl
Last active September 30, 2021 16:44
dynamic regex switch (Perl5)
#!/usr/bin/perl
use feature say;
my @a = (
" asd",
" asd ",
" bsd",
" XXX",
"10000"
);
@stelf
stelf / dynamic.regex.switch.ps1
Last active September 30, 2021 16:49
dynamic regex switch (PowerShell)
[string[]] $a = (
" asd",
" asd ",
" bsd",
" XXX",
"10000"
)
[string] $spacer = ""
@stelf
stelf / install.oracle.managed.dependencies.ps1
Created July 21, 2021 13:58
manual (&local) installation of Oracle.ManagedDataAccess.Core dependencies from nuget v2.0 API
function Install-CollectDependencies {
Set-PackageSource -SourceName nuget.org -NewLocation https://www.nuget.org/api/v2
Install-Package System.Numerics.Vectors,System.ValueTuple -SkipDependencies -Destination packages
Install-Package System.Runtime.CompilerServices.Unsafe -SkipDependencies -Destination packages
Install-Package System.Memory,System.ValueTuple -SkipDependencies -Destination packages
Install-Package System.Threading,System.Threading.Tasks -SkipDependencies -Destination packages
Install-Package Runtime.Native.System,System.Runtime.Handles,System.Runtime.InteropServices -SkipDependencies -Destination packages
Install-Package System.Reflection.Extensions -SkipDependencies -Destination packages
Install-Package System.Console,System.AppContext,System.Collections -SkipDependencies -Destination packages
Install-Package Microsoft.Win32.Primitives,System.Globalization.Calendars -SkipDependencies -Destination packages
@stelf
stelf / substitute.js
Created July 19, 2021 13:34
several attepts to some informatics assignemnt
// -- this GIST is available under the conditions of
// -- https://creativecommons.org/licenses/by/4.0/
//
// this are four approaches to solution to one trivial task from
// Bulgaria's softuni's curriculum that i was asked to help with
//
//
// the input is basically 4 integers K, L, M, N
//
// then we have a integer ranges for the digits A, B, C, D
@stelf
stelf / oracle.net.core.connect.ps1
Created July 19, 2021 09:16
establish Oracle connection via .NET Core from Powershell using TNS config
# this GIST is available under the conditions of
# https://creativecommons.org/licenses/by/4.0/
using namespace Oracle.ManagedDataAccess.Core
# the following is needed if the connector is already globally installed
# but IS OKAY even without dependencies, as these install half gig of the .NET core libs anyway
#
# $dest = "$(gl)\packages\"
# Install-Package -Name Oracle.ManagedDataAccess.Core -Destination $dest -SkipDependencies
rg -UiH --multiline-dotall --pcre2 --glob *.raml '(?x) ^\s*description:.*? (?= ( ^\s*\# | ^[\s]+[/\-\w(){}]+: | ^$ ))'