Skip to content

Instantly share code, notes, and snippets.

View stelf's full-sized avatar
🦌
focusing 🦊

Gheorghi stelf

🦌
focusing 🦊
View GitHub Profile
@stelf
stelf / non-proxy.js
Created March 26, 2018 17:07
nodejs/express http proxy mix of websocket and http splitter
var port = 3333;
var proxy = require('http-proxy-middleware');
var express = require('express');
var app = express();
var server = require('http').Server(app);
server.listen(port, () => {
[core|vscr| all] Checking for mask most_app license group=administrators
[core|vscr| all] License manager : already contains slot administrators for session : 122323463
[core|cntx| all] Unable to do fast lookup by CODE for core.object_calculation_script
[core|vscr| all] most.protocol_sale.auto_assign_stock:: process [1] sale instances.
[core|vscr| all] most.protocol_sale.auto_assign_stock: selected date: 08.12.2017
[core|vscr| all] auto_assign_stock: going to work with 1 stocks.
[core|vscr| all] [190977]
[core|vscr| all] auto_assign_stock: 1 protocol objects selected for processing
[core|vscr| all] auto_assign_stock: sale PRO000190977 has quantity > 0
@stelf
stelf / bad compiled VSQL
Last active December 3, 2017 20:07
bad VSQL result
error:Error on creating prepared statement: SELECT a2_RF0."id" AS PVA_1
FROM VISIONR.pv_m_prt AS o0
LEFT JOIN VISIONR.pv_m_art AS a1 ON (o0."article" = a1.id) AND ( ( ( ( ( ( ( ( a1."session_id" IS NULL OR a1."session_id" = 121484289 ) ) AND a1."is_archived" = 0 ) AND a1."id" <> 0 ) ) AND a1."objectdef" IN ( 3 , 6656 ) ) ) )
LEFT JOIN VISIONR.pv_m_ope AS a2 ON (a1.id = a2."article") AND ( ( ( ( ( ( ( ( a2."session_id" IS NULL OR a2."session_id" = 121484289 ) ) AND a2."is_archived" = 0 ) AND a2."id" <> 0 ) ) AND a2."objectdef" IN ( 3 , 5642 , 5644 , 5645 , 14336 , 14337 ) ) ) )
LEFT JOIN VISIONR.pv_m_opg AS a3 ON (a2."opg" = a3.id) AND ( ( ( ( ( ( ( ( a3."session_id" IS NULL OR a3."session_id" = 121484289 ) ) AND a3."is_archived" = 0 ) AND a3."id" <> 0 ) ) AND a3."objectdef" IN ( 3 , 5643 ) ) ) )
LEFT JOIN VISIONR.pv_m_ope AS a5 ON (a3.id = a5."opg") AND ( ( ( ( ( ( ( ( a5."session_id" IS NULL OR a5."session_id" = 121484289 ) ) AND a5."is_archived" = 0 ) AND
<import revision="$LastChangedRevision: 11454 $" xmlns:xi="http://www.w3.org/2001/XInclude">
<most module_alias="m" use_prefix="true">
<objectdefs>
<protocol_return parent_objectdef="most.protocol_stock">
<total mode="delete"/>
</protocol_return>
@stelf
stelf / -
Created November 17, 2017 15:42
# decode-dimms version 6231 (2014-02-20 10:54:34 +0100)
Memory Serial Presence Detect Decoder
By Philip Edelbrock, Christian Zuckschwerdt, Burkart Lingner,
Jean Delvare, Trent Piepho and others
Decoding EEPROM: /sys/bus/i2c/drivers/eeprom/9-0050
Guessing DIMM is in bank 1
@stelf
stelf / proxyftw.js
Last active October 14, 2025 20:11
using ES6 proxies and async/await to dynamically, yet almost transparently connect to some remote data provider
let providerHandler = {
get: async(target, name) => {
console.log('load someting from remote...')
return new Promise( (res, rej) => {
setTimeout(() => res(42), 4200)
})
},
set: function (obj, prop, value) {
return new Promise((res, rej) => {
@stelf
stelf / express-rss-sax-stream.js
Last active November 14, 2017 22:43
quick demo of how to mix objectMode with String streams and pipe to web
// rss stream reader with nodejs and express solution by stelf
const saxStream = require('sax-stream')
const fs = require('fs')
const http = require('http')
const express = require('express')
const { Transform } = require('stream')
const app = express();
const rssloc = 'http://abcnews.go.com/abcnews/topstories'
function radix(arr) {
let change = false;
let mask = 1
let res = new Array(arr.length)
do {
mask = mask * 10
const bucket = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
var qsort = function(arr) {
let partition = function(lidx, ridx) {
let pval = arr[lidx] // note: ! may be chosen differently
let l = lidx - 1
let r = ridx + 1
// >>>>>>> move L towards end
// [ lesser, lesser, L, ?, ?, ?, ... (piv) ... , ?, ?, ?, R, greater, greater ]
iptables -t nat -L PREROUTING
iptables -t nat -L POSTROUTING
iptables -L FORWARD
iptables -t nat -A POSTROUTING -o vlan2 -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp -i vlan2 --dport 3000 -j DNAT --to-destination 195.230.10.206:3000
iptables -t nat -A PREROUTING -p tcp -i vlan2 --dport 22 -j DNAT --to-destination 195.230.10.206:2299