Skip to content

Instantly share code, notes, and snippets.

@lmcneel
lmcneel / remove-node-modules.md
Last active November 9, 2024 05:27
How to remove node_modules after they have been added to a repo

How to remove node_modules

Create a .gitignore file

  1. Check for an existing .gitignore file in the project directory
ls -a
@ezhov-da
ezhov-da / windows-Запрещенные символы.txt
Last active January 13, 2023 22:24
windows запрещенные символы.txt
https://ru.wikipedia.org/wiki/%D0%98%D0%BC%D1%8F_%D1%84%D0%B0%D0%B9%D0%BB%D0%B0
<pre>
Запрещённые символы
Многие операционные системы запрещают использование некоторых служебных символов.
Запрещённые символы Windows (в различных версиях):
\ — разделитель подкаталогов
@superbrothers
superbrothers / kubectl-delete_all
Last active October 1, 2024 05:27
Kubernetes: Delete all objects in the namespace
kubectl delete "$(kubectl api-resources --namespaced=true --verbs=delete -o name | tr "\n" "," | sed -e 's/,$//')" --all
@jlevy
jlevy / simple-hash.js
Last active October 29, 2024 14:57
Fast and simple insecure string hash for JavaScript
// These hashes are for algorithmic use cases, such as bucketing in hashtables, where security isn't
// needed and 32 or 64 bits is enough (that is, rare collisions are acceptable). These are way simpler
// than sha1 (and all its deps) or similar, and with a short, clean (base 36 alphanumeric) result.
// A simple, *insecure* 32-bit hash that's short, fast, and has no dependencies.
// Output is always 7 characters.
// Loosely based on the Java version; see
// https://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript
const simpleHash = str => {
let hash = 0;
@ark0f
ark0f / bevy_top_left.rs
Last active January 6, 2023 17:54
DOES NOT WARK BECAUSE OF FLICKERING; Top left origin with pixel-perfect scaling in 2D in Bevy
fn setup(mut commands: Commands) {
let mut camera = OrthographicCameraBundle::new_2d();
camera.orthographic_projection.window_origin = WindowOrigin::BottomLeft;
camera.orthographic_projection.scaling_mode = ScalingMode::WindowSize;
commands.spawn(camera);
}
fn top_left_origin(
windows: Res<Windows>,
@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();
// Бежим подряд без параллелизма, рутуб всё равно ограничивает кол-во запросов с клиента, поэтому смысла ускорять нет, не даст быстрее
@TroyKomodo
TroyKomodo / rmq.rs
Last active April 25, 2024 09:33
rmq connection pool
use std::{
sync::{atomic::AtomicUsize, Arc},
time::Duration,
};
use anyhow::{anyhow, Result};
use arc_swap::ArcSwap;
use async_stream::stream;
use futures::{Stream, StreamExt};
use lapin::{