Skip to content

Instantly share code, notes, and snippets.

View VityaSchel's full-sized avatar
:electron:
exploring

Viktor Shchelochkov VityaSchel

:electron:
exploring
View GitHub Profile
@VityaSchel
VityaSchel / blender.py
Created April 1, 2022 21:04
Import umap level files from Unreal Engine games to Blender
import bpy
import json
from mathutils import Euler
import math
base_dir = 'C:\\Users\\VityaSchel\\Documents\\umap-exporter\\'
objects = json.load(open(base_dir + 'mapped.json'))
if(len(bpy.data.collections) > 1):
@VityaSchel
VityaSchel / .env
Last active October 12, 2022 18:57
Telegram MTProto program template (with login, 2FA support and @mtproto/core module)
APP_ID=
APP_HASH=
PHONE=
TWO_FA_PASSWORD=
@VityaSchel
VityaSchel / Telegram Bot working on Nginx FastCGI template (NodeJS and JavaScript).js
Last active February 27, 2022 13:11
Telegram Bot working on Nginx FastCGI template (nodejs/javascript)
#!/root/.nvm/versions/node/v16.13.0/bin/node
import fss from 'fs' // DO NOT change to fs/promises because 'The "path" argument must be of type string or an instance of Buffer or URL. Received type number (0)'
import fs from 'fs/promises'
const __dirname = new URL('.', import.meta.url).pathname
console.log('Content-type:text/plain')
console.log('')
async function processBody() {
@VityaSchel
VityaSchel / Comparison of all PSN API wrappers for JavaScript.md
Last active January 22, 2022 19:09
Comparison of all PSN API wrappers for JavaScript

I have tested all 4 wrappers for JavaScript

Library name Is archived Last commit Can log in Can return trophies Can read messages First encountered error
PSNjs 2015 ? ? `{"error_code":4151,"error":"unauthorized_client","error_description":"Client does not have grant type: ["implicit","authorization_code"]","docs":"http
@VityaSchel
VityaSchel / react-pdf-table.js
Last active December 14, 2021 16:42
Tables for @react-pdf/renderer
import React from 'react'
import { View, StyleSheet } from '@react-pdf/renderer'
const styles = StyleSheet.create({
row: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-around',
alignContent: 'center',
flexWrap: 'nowrap',
@VityaSchel
VityaSchel / discriminant-vieta.js
Created October 4, 2021 17:11
Калькулятор корней через дискриминант и теорему, обратную теореме Виета
function guesser(k1, k2) {
for(let i = -Math.abs(k1); i < Math.abs(k1); i++){
for(let j = -Math.abs(k2); j < Math.abs(k2); j++){
if(i+j === k1 && i*j === k2){
return [i, j]
}
}
}
console.log('не удалось отгадать')
}
@VityaSchel
VityaSchel / index.mjs
Created July 16, 2021 15:41
Autofix for eslint because of React 17 new JSX transform: no-unsed-vars, import React from 'react' React is defined but never used
import fs from 'fs/promises'
// eslint.json must contain all files from project
// eslint ./ -o eslint.json -f json
// Only works with es6 imports
// Only works with react import on separate line
// Removes react from any line in file but only once
// Does not remove prop types
@VityaSchel
VityaSchel / YouTubeChatSubscribe.js
Last active March 3, 2024 06:03
YouTube chat subscription JavaScript: Get every new message during YouTube livestream chat with DOM Mutation Observer
/* YouTube Chat Subscription Function. Written by VityaSchel
* Subscribe to new messages in YouTube chat in JS (browser-only)
* Pass callback function which gets 2 parameters: author, message
* !! Does not support emojies, user badges, message deletions !!
*/
function subscribeToChat(chatMessageCallback) {
let chatObserverCallback = (mutationsList, observer) => {
let messageMutation = mutationsList.filter(mutation => mutation.target.id === 'items').find(itemDOM => itemDOM.addedNodes.length > 0)
if(messageMutation === undefined || messageMutation.addedNodes.length === 0) { return; }
@VityaSchel
VityaSchel / index.js
Last active April 9, 2023 16:09
JS Random range visualizer
/* RANGE VISUALIZER BY VITYASCHEL
This script is useful when you want to check equality of random results.
Run testingRandom with function and limit of checks
More checks = more accurate
Example: testingRandom(() => Math.random().toFixed(1), 10000)
Output:
0.0 *********
0.1 *******************
0.2 *******************
0.3 ******************
@VityaSchel
VityaSchel / yandexmailadsremover.js
Created October 8, 2020 13:28
Remove ads from PC version of mail.yandex.ru by index... Use any simple extension like AddJS to append this script on mail.yandex.ru domain
setInterval(function(){
let jslayout = document.getElementsByClassName("js-layout-aside-inner-box");
if(jslayout[0] != undefined){
if(jslayout[0].children.length > 7){
jslayout[0].children[6].outerHTML = "";
jslayout[0].children[7].outerHTML = "";
}
}
},100);