Skip to content

Instantly share code, notes, and snippets.

View IlkhamGaysin's full-sized avatar
🏠
Working from home

Ilkham Gaysin IlkhamGaysin

🏠
Working from home
View GitHub Profile

Lazy

a = [1,2,3,4,2,5].lazy.map { |x| x * 10 }.select { |x| x > 30 } #=> no evaluation and creations of arrays

a.to_a #=> [40, 50], evaluation performed - no intermediate arrays generated.

Eager

Options:

  • е — encrypt archive contents with password;
  • j — drop the path to the root folder i.e. Archive only its contents without regard to the folder itself;
  • r — recursively add folder contents.
 zip -ejr [path_of_new_file_with_name] [path_to_file_to_zip]
@IlkhamGaysin
IlkhamGaysin / concatenate_all_tsx-gz_files.md
Last active June 4, 2021 12:37
Concatenate all tsv.gz files info one

Problem

Usually logs files are stored in butches with tsv.gz file extention. Often we need to search trough these logs as they are the one file.

Solution

we can unzip and concatenate the files into one file and grep over it.

  gunzip -c *.gz > alllogs
@IlkhamGaysin
IlkhamGaysin / homebrew-install-older-version.md
Created April 18, 2023 14:49
Homebrew: Install an older version of a formula

Homebrew: Install an older version of a formula

kubernetes-cli (v1.10.3) taken as example

  1. Downgrade Homebrew to the commit which upgrades the formula to the specific version that we want
$ cd "$(brew --repo homebrew/core)"
$ git log Formula/kubernetes-cli.rb

...