Tuesday, December 12, 2023

Leetcode type problem - Sub-Arrays problem

 Generate number of sub arrays with a particular sum: E.g. nums = [1,1,1] with sum 2

arr = [1,1,1]
SUM =2
#arr = [1,2,2,3,4,5]
#SUM = 5

sub_arrays = []
arr = arr.sort

arr.each_with_index do |n, index|
  if n == SUM
    sub_arrays << [n]
    next
  end
  rest_of_array = arr[(index+1)..-1]
  temp_arr = [n]

  rest_of_array.each do |m|
    temp_arr << m
    if temp_arr.sum == SUM
      # We found a sub_array!
      sub_arrays << temp_arr
      # There might be duplicates of m, so let us remove m from temp_arr and continue
      temp_arr = temp_arr[0..temp_arr.length-2]
    end
    if temp_arr.sum < SUM
      # do nothing; we can continue to add more elements
    end
    if temp_arr.sum > SUM
      # discard all elements except n
      temp_arr = [n]
    end
  end
end

puts sub_arrays.to_s

Sunday, December 10, 2023

Cryptography Foundations

 Below is an excerpt from the book - Securing Cloud Applications (manning.com)


Wednesday, October 11, 2023

Rails and JS - No Build for JS

https://world.hey.com/dhh/you-can-t-get-faster-than-no-build-7a44131c

We're making it using vanilla ES6 with import maps for Hotwire, and vanilla CSS with nesting and variables for styling. All running on a delightfully new simple asset pipeline called Propshaft. 

Saturday, September 16, 2023

Rails: class_attribute

https://chat.openai.com/c/388e1263-46a6-4406-b16d-8094b8232dfb

In essence, whenever you find yourself thinking, "I need a class-level configuration that should have a default, but I also want the flexibility to customize it for certain subclasses or instances," class_attribute is a tool you might consider using.

Tuesday, February 28, 2023

Introducing MRSK: Deploy web apps anywhere from bare metal to cloud VMs using Docker with zero downtime.

Introducing MRSK: Deploy web apps anywhere from bare metal to cloud VMs using Docker with zero downtime. No need to brave running k8s yourself. This video builds an app from scratch and deploy to two different clouds in less than 20 mins!


Wednesday, February 15, 2023

How to learn Machine Learning

https://twitter.com/machsci/status/1625569733126033408?s=21&t=Urcac12Ha89dnjd31vAAIg

https://vickiboykis.com/2022/11/10/how-i-learn-machine-learning/

https://pytorch.org/tutorials/beginner/deep_learning_60min_blitz.html

https://twitter.com/jhoang314/status/1624829824782028806?s=21&t=Urcac12Ha89dnjd31vAAIg

https://www.ninoristeski.com/how-to-find-the-best-resources-on-machine-learning/

...

Start with tabular data and linear/logistic regression. Then grab lightgbm with automl, learn the common explainability methods and focus on anything BUT selecting an algorithm. When you got that, learn all other algorithms in and out and look for model innovations.

...

Just learn BigQuery and it's machine learning capabilities and read books alot and avoid youtube videos as much as possible.

...

Start with SQL, Python. Pick a popular ML library e.g. Sklearn, Keras, XGBoost and apply it to a dataset

...

Start by getting familiar with the fundamentals of machine learning, such as linear algebra, calculus and probability theory. Also read up on popular algorithms to get a better understanding of how they work.

...

Learn statistics and probability a lot of concepts require simple concepts from those fields, if you want to go a little further learn abstract geometry is going to allow you to learn about how nonlinear models implement hyperplanes.

ChatGPT Tutorials

ChatGPT Tutorial:


Advanced ChatGPT Guide: