Skip to content

Instantly share code, notes, and snippets.

View vitaly-t's full-sized avatar
🐈
Meow!

Vitaly Tomilov vitaly-t

🐈
Meow!
View GitHub Profile
import {pipeAsync, map, waitRace, delay} from 'iter-ops';
const i = pipeAsync(
[1, 2, 3],
map(s => Promise.resolve(s * 10)),
delay(100),
waitRace(3)
);
(async function () {
//////////////////
// RUN THIS FIRST: npm install [email protected]
//
// The example below crashes NodeJS (it runs out of memory)
// operator source: https://github.com/vitaly-t/iter-ops/blob/wait-cache/src/ops/async/wait-cache.ts
//////////////////
import {map, pipeAsync, waitCache} from 'iter-ops';
-- Make IDV feature ON by default:
UPDATE cfg_feature SET enabled=true WHERE feature_key='ID_VERIFICATION';
INSERT INTO text_item (id, language_code,
section,
key,
value,
version, created_by, modified_by,
modified_date, created_date)
VALUES (${uuid_function}, 'en',
INSERT INTO text_item (id, language_code,
section,
key,
value,
version, created_by, modified_by,
modified_date, created_date)
VALUES (${uuid_function}, 'en',
'APPLICANT_IDV',
'CONTACT_US',
'Please contact us, if you are experiencing any issues submitting your identification',

FirstHome UI

Steps for changing local UI to use FirstHome interface layouts.

  1. Remove all database schemas.
  2. Re-run the API to auto-create the entire database.
  3. Add a firsthome tenant:
"C:\Program Files\Java\jdk-11.0.15\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2022.1\lib\idea_rt.jar=56450:C:\Program Files\JetBrains\IntelliJ IDEA 2022.1\bin" -Dfile.encoding=UTF-8 @C:\Users\vital\AppData\Local\Temp\idea_arg_file981706154 ie.creditlogic.CollectLogicApplication
10:24:26,154 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
10:24:26,154 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
10:24:26,155 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/Work/CL/collectlogic-api/build/resources/main/logback.xml]
10:24:26,194 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
10:24:26,198 |-I
"C:\Program Files\Java\jdk-11.0.15\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2022.1\lib\idea_rt.jar=55119:C:\Program Files\JetBrains\IntelliJ IDEA 2022.1\bin" -Dfile.encoding=UTF-8 @C:\Users\vital\AppData\Local\Temp\idea_arg_file1322926934 ie.creditlogic.CollectLogicApplication
09:59:47,440 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
09:59:47,441 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
09:59:47,441 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/Work/CL/collectlogic-api/build/resources/main/logback.xml]
09:59:47,495 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
09:59:47,499 |-
/*
According to Pierre Dusart, once x > 598, the following becomes true:
(x/ln x)(1 + 0.992/ln x) < π(x) < (x/ln x)(1 + 1.2762/ln x)
It means we need pre-calculated primes only up to 593.
See: https://primes.utm.edu/howmany.html
*/
export const primes = [
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89,
97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
import {generatePrimes} from 'primes-generator';
// there are 1,270,607 primes in the first 20mln:
const iterator = generatePrimes({boost: 1_270_607});
let a, lastValue = 0, count = 0;
const start = Date.now();
do {
a = iterator.next();
function sieveOddPrimesTo(bufferLimit: number) {
const lmti = (bufferLimit - 3) >> 1;
const sz = (lmti >> 3) + 1;
const cmpSts = new Uint8Array(sz);
for (let i = 0; ; ++i) {
const p = i + i + 3;
const sqri = (i << 1) * (i + 3) + 3;
if (sqri > lmti) {
break;
}