Skip to content

Instantly share code, notes, and snippets.

@qfox
qfox / rules_to_problem_solving.md
Created July 23, 2025 23:18 — forked from neaxi/rules_to_problem_solving.md
Rules to problem solving

Rules to Problem Solving

(Unknown author)

Rule #1: Don't assume you understand the problem

This is one of the classic mistakes of problem solving - you think you understand what's going on, but you didn't look deep enough or get enough information to really get it. Before starting to solve any problem, be sure you spend some time and be absolutely sure you understand exactly what's going in.

Rule #2: Don't assume that the person who reported the problem understands the problem either

@qfox
qfox / enc-dec.md
Last active April 14, 2023 15:45
Безопасно передаём файлики

Безопасно передаём файлики

TL;DR

Команда Что делает На чьей стороне
gpg --full-generate-key Генерируем ключи Получатель файла
gpg --armor --export {KEY_ID} > {KEY_ID}.pub.gpg Выгрузка ключа для передачи Получатель файла
gpg --import {KEY_ID}.pub.gpg Импорт ключа для шифрования Владелец файла
gpg -r {KEY_ID} -e {FILE} Шифрование файла Владелец файла
@qfox
qfox / rutube-unsubscribe.js
Created December 24, 2022 16:47
Отписаться (удалить) от всех подписок на rutube (рутуб)
// Нужно открыть devtools в хроме или firefox, и скопировать туда полностью содержание файла
// Вспомогательная пауза для 429
const pause = delay => new Promise(resolve => setTimeout(resolve, delay));
// Забираем список на кого мы подписаны из ручки
const subscriptionReq = await fetch('https://rutube.ru/api/v1/subscription/cards/detail?limit=1000&offset=0', { credentials: 'include' });
const { results } = await subscriptionReq.json();
// Бежим подряд без параллелизма, рутуб всё равно ограничивает кол-во запросов с клиента, поэтому смысла ускорять нет, не даст быстрее
@qfox
qfox / ContinuousEffect.ts
Created October 25, 2021 19:58
Continuous effect for effector
import { createEffect, createEvent, Effect, Event } from 'effector';
export interface ContinuousEffect<Params, Done, Payload = Done, Fail = Error> extends Effect<Params, Done, Fail> {
readonly progress: Event<{params: Params; result: Payload}>
readonly progressData: Event<Payload>
}
export function createContinuousEffect<Params, Done, Payload = Done, Fail = Error>(
handler: ((params: Params) => Done | Promise<Done> | Iterator<Payload, Done> | AsyncIterator<Payload, Done>)
) {
const args = process.argv.slice(2);
const cell = {
block: args[0],
mod: {
name: args[1],
val: args[2],
}
};
@qfox
qfox / links.md
Last active July 26, 2019 09:23
Public links
node_modules
/ui-kit
/button
/button.css
/[email protected]
vs
node_modules
/ui-kit
@qfox
qfox / x.ts
Created February 6, 2018 16:10
interface NestedWalker {
protected ctx: { path: string, cell: BemEntityName };
protected naming: BemNamingEntity;
public isLeaf(path): boolean;
public isDir(path): boolean; should we go deeper?
};
/*
/lib level, library
@qfox
qfox / README.md
Created January 24, 2018 00:51
Import one git repo as a subdirectory to another (monorepo maker)

monorepish

How to use

cd git-monorepo
env PACKAGE_NAME=babel/babel-bridge node import | bash
'use strict';
const filtr = require('filterable');
module.exports = toJSFunction;
function toJSFunction(conditions) {
const keys = [];
const includes = ($v, v) => typeof v === 'string' ?
$v.toLowerCase().indexOf(v.toLowerCase()) !== -1 :
v.some((_v) => $v.toLowerCase() === _v.toLowerCase());