Skip to content

Instantly share code, notes, and snippets.

View Beyarz's full-sized avatar
💎
Searching for Ruby gems

Beyar Beyarz

💎
Searching for Ruby gems
  • Sweden
  • 14:05 (UTC +02:00)
View GitHub Profile
@Beyarz
Beyarz / optimize_video.md
Last active July 6, 2024 13:46
Automatically optimize every video in a folder via ffmpeg to save up storage. It's multithreaded and supports GPU acceleration, just put this script in the folder and execute it.

Optimize video

Run

  1. Download the script
  2. Put this file in the same folder as your videos
  3. Run: ruby optimize_video.rb, for help, use ruby optimize_video.rb --help

Watch log / debug

@Beyarz
Beyarz / itob.rb
Created August 19, 2023 19:37
Convert integer to binary
def itob(number)
decimals = []
while (number.positive?)
number, remainder = number.divmod(2)
decimals << remainder
end
bits = decimals.length.times.map { |i| 2**i }
validate_sum = 0
@Beyarz
Beyarz / README.md
Last active May 31, 2023 06:48 — forked from andrewmd5/README.md
Decipher this text - solution

Decipher this text

Can you crack the secret message hidden within this cipher? I've taken a phrase and encoded it into a string of words that look like "meatball". It's a bit tricky, but I believe in your skills!

Cipher Text:

mEaTbALLmEAtBALLmEATbALL, mEATBalLmEAtBALLmEATbAlL mEAtbalLmEATbaLlmEAtbAlL mEATbaLLmEATbAlLmEATballmEAtbAlLmEATbaLl mEATbaLLmEAtBAlLmEAtbalLmEATbaLlmEATbAll! mEaTbALLmEAtbalLmEAtBALlmEATbAll mEAtbalL mEAtBaLlmEAtBALLmEAtbaLl? mEaTbALLmEAtbAlL'mEATbaLlmEAtbAlL mEAtBallmEAtBalLmEATbaLlmEAtBalLmEAtBALlmEAtbALL: mEAtbalLmEAtBALlmEAtbAllmEATbaLlmEAtbAlLmEATbALL@mEAtbaLlmEAtbAlLmEATbAllmEATbALLmEAtBalLmEATBallmEATbAllmEAtBAllmEAtbalLmEAtbaLlmEATbaLL.mEAtbaLLmEAtBALLmEAtBAlL
@Beyarz
Beyarz / used-by-apple.md
Last active March 20, 2025 20:20
Products and services used by Apple Inc, since Sep 12, 2019
@Beyarz
Beyarz / note.txt
Created December 30, 2022 23:37
Windows checksum
certutil -hashfile something.zip SHA256
@Beyarz
Beyarz / .gemrc
Created December 23, 2022 23:34
Get faster gem installs ~/.gemrc
install: --no-rdoc --no-ri
@Beyarz
Beyarz / ??.js
Last active May 24, 2023 15:12
Javascript tips, tricks & shorthands
// Javascript nullish coalescing operator
// Is set to 0
let x = 0 ?? "hello"
// Is set to goodbye
let y = undefined ?? "goodbye"
// Is set to hello
let z = null ?? "hello"
@Beyarz
Beyarz / dig.md
Created August 4, 2022 13:53
dig dns lookup

Dig dns query

Query using local config

dig feber.se

Query using chosen resolver

dig @1.1.1.1 feber.se

@Beyarz
Beyarz / pictures.rb
Created July 15, 2022 12:45
Get all images from directory
pictures = Proc.new { |file| file.match(/(png|jpeg|jpg)/) }
Dir.entries('.').select &pictures
=> ["image1.png", "image2.png", "pic.jpg", "picture.jpeg"]
@Beyarz
Beyarz / &.rb
Last active May 30, 2023 20:35
Ruby shorthands shortcut
# &, optional chainig
[1,2,3,4,5,6][5]&.to_s
=> "6"
[1,2,3,4,5,6][6]&.to_s
=> nil
# &, map shorthand notation
to_s = Proc.new { |x| x.to_s }
=> #<Proc:0x00000001065bdef0 (irb):8>
[1,2,3].map &to_s