Skip to content

Instantly share code, notes, and snippets.

View rluvaton's full-sized avatar
:octocat:
Programming

Raz Luvaton rluvaton

:octocat:
Programming
View GitHub Profile
@rluvaton
rluvaton / README.md
Last active July 4, 2022 14:32
Stream concurrency sending in order

Output

$ node index.js
[45] map a
[45] map b
[45] map c
[45] filter az
[55] filter bz
[55] filter cz // <- This wait to bz to finish!
@rluvaton
rluvaton / usage.js
Created June 30, 2022 05:40
UseTransformer
fs.readFileStream("./file.pcapng")
.useTransform(async function* (source) {
let block = Buffer.alloc(0);
for await (const chunk of source) {
block = Buffer.concat(block, chunk);
if (block.length < REQUIRED_BLOCK_SIZE_TO_GET_TO_TOTAL_LENGTH) {
continue;
@rluvaton
rluvaton / Dockerfile
Created June 22, 2022 14:24
Elastic Search v6 with ARM support
FROM ubuntu:bionic-20220531
# Must be root to install the packages
USER root
# Install required deps
RUN apt update
RUN apt -y install gnupg wget apt-transport-https coreutils java-common
# Import Elasticsearch GPG Key
@rluvaton
rluvaton / regex-snippets.md
Created May 11, 2022 07:24
Regex Snippets

Regex Snippets

Files

Match only one lines that have 1 node_modules folder in their string

^(?:(?!node_modules).)*(?:node_modules)(\/|$)(?!.*(?:node_modules))
@rluvaton
rluvaton / README.md
Last active March 15, 2022 19:54
Helpful bash snippets

Helpful bash snippets

Git

Diff

Count number of additions in diff between HEAD and master for some file pattern

git diff master --numstat | \
@rluvaton
rluvaton / README.md
Last active October 27, 2022 07:04
queryBy vs toBeInTheDocument and getBy* in @testing-library/react

queryBy* and toBeInTheDocument vs getBy*

queryBy* and toBeInTheDocument

Test:

it('should render the component and contain the shot.name', () => {
  // Arrange
  const shot: ShotTitleProps = {
    name: faker.name.title(),
a
@rluvaton
rluvaton / README.md
Last active August 26, 2022 12:33 — forked from stefanvangastel/docker-load-and-push.sh
Bash scripts to pull, (optional) retag, save, load and push Docker images. Created to provide easy means to download an image, retag it to use a private registry and then save it to an external disk. In a offline or on-premise environment you can use the load and push script to load images and push them to a private registry.

Docker images tar utils

docker-load-and-push

Install globaly

sudo curl -o /usr/local/bin/docker-load-and-push https://gist.githubusercontent.com/rluvaton/ef6415c79c35c5b11c535040e79ab43b/raw/19cb82651a10d5256f512331b484dee8a19a8058/docker-load-and-push.sh && sudo chmod +x /usr/local/bin/docker-load-and-push
@rluvaton
rluvaton / remove-all.js
Created July 1, 2020 11:23
Remove all recording from terminalizer profile #helper #terminalizer #remove
function getAllRecordingsUrl() {
return Array.from(document.querySelectorAll('a[href^="/view/"]')).map(a => a.href)
}
function sendDeleteRecordingReq(id) {
return fetch(`https://terminalizer.com/delete/${id}`, {
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"accept-language": "en-US,en;q=0.9,he;q=0.8",
"sec-fetch-dest": "document",
@rluvaton
rluvaton / README.md
Last active October 7, 2022 06:55
Mirror Node.js dist and download all npm versions for windows #script #npm #node #mirror

Scripts that mirror nodejs and npm

Note: The npm download script currently only download zip files

Improvement to do:

  • Move to dedicated repo
  • Add CLI tool for the npm and node download script
  • Replace request lib with not deprecated one
  • Download index.json by itself
  • Install another formats of npm (not just zip)