Skip to content

Instantly share code, notes, and snippets.

View VityaSchel's full-sized avatar
🕶️
svelting

Viktor Shchelochkov VityaSchel

🕶️
svelting
View GitHub Profile
so I had to find a way to control ender dragon and every time it was flying away very fast but I found that with minecart it doesn't move but minecart cannot be invisible in any way so there is two command how to imitate minecart with ender dragon passanger
1. pick any two tags (ex. dragon, stand)
2. both have to be in cycled repetiteve command blocks
in this first command stand moving away to 0.001 block every tick
execute at @e[tag=stand] run tp @e[tag=stand] ~ ~ ~0.001 0 0
in second it teleports dragon to it every tick
So I suppose I did a very stupid mistake somewhere in 4-6,
but I'm really tired to seek for it and just skipping 4 and
6 steps isn't help, if someone found what's wrong with my
code, pls write somewhere idk I want to sleep
You may use chain command blocks, stack all them together
or use repeaters like me. Important thing to remember is that
they must be executed followed by each other like here.
0. Create objectives with dummy or trigger type (this way
these objectives won't be affected by game events and can
@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);
@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 / YouTubeChatSubscribe.js
Last active September 3, 2024 11:11
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.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 / 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 / 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 / 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 / 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() {