Skip to content

Instantly share code, notes, and snippets.

View stelf's full-sized avatar
🦌
focusing 🦊

Gheorghi stelf

🦌
focusing 🦊
View GitHub Profile
@stelf
stelf / 100nums.random.js
Created December 25, 2018 13:08
100 random.org nums
const http = require('https')
const querystring = require('querystring')
const adr = 'https://www.random.org/integers/?';
const qry = querystring.stringify({
num: 100,
min: 1,
max: 100,
col: 1,
@stelf
stelf / for.ifs.sh
Created August 30, 2019 14:26
IFS bash change example
IFS=$'\n'
dest=FL_insurance_sample.csv
counties=$(cut -d',' -f 3 $dest | sort | uniq)
for county in $counties
do
cnt=$(grep $county $dest | wc -l)
echo $county has $cnt
done
@stelf
stelf / rx.monitor.ps.js
Last active July 19, 2021 09:38
monitor bash processes via rxjs
// this GIST is available under the conditions of
// https://creativecommons.org/licenses/by/4.0/
const psList = require('ps-list');
const { interval, from } = require('rxjs');
const { switchMap, filter, map } = require('rxjs/operators');
interval(500)
.pipe( switchMap(() => psList()),
@stelf
stelf / research.oracle.usage.sql
Last active July 19, 2021 09:38
query oracle usage stats
--- # this GIST is available under the conditions of
--- # https://creativecommons.org/licenses/by/4.0/
SELECT
MAX(LAST_SAMPLe_DATE) AS "Last use",
NAME AS "Name",
CAST (TO_CHAR(SUM(DETECTED_USAGES) / SUM(TOTAL_SAMPLES) * 100, '999') AS VARCHAR2(5)) AS "%"
FROM
dba_feature_usage_statistics
WHERE
@stelf
stelf / create.fdw.sql
Last active July 19, 2021 09:37
Oracle 19 foreign data wrapper in PostgreSQL setup
--- this GIST is available under the conditions of
--- https://creativecommons.org/licenses/by/4.0/
CREATE EXTENSION oracle_fdw;
drop server orcl19;
CREATE SERVER orcl19 FOREIGN DATA WRAPPER oracle_fdw
OPTIONS (dbserver '//localhost:1521/ORCL19');
GRANT USAGE ON FOREIGN SERVER orcl19 TO postgres;
@stelf
stelf / outlook.search.ps1
Last active July 19, 2021 09:37
iterate outlook folder item search results via powershell COM automation
# this GIST is available under the conditions of
# https://creativecommons.org/licenses/by/4.0/
# example how to search Outlook mailbox via COM automation
# + find lines with specific text while also further filtering these
# this approach is actually much more readable than the VB examples in MS help
# thanks to escaped quotes not subject to some ugly concatenation practices
#
# useful references here:
# https://docs.microsoft.com/en-us/office/vba/outlook/how-to/search-and-filter/filter-the-body-of-a-mail-item
rg -UiH --multiline-dotall --pcre2 --glob *.raml '(?x) ^\s*description:.*? (?= ( ^\s*\# | ^[\s]+[/\-\w(){}]+: | ^$ ))'
@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
@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 / 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