Skip to content

Instantly share code, notes, and snippets.

View saadbinakhlaq's full-sized avatar
🕴️
up

Saad saadbinakhlaq

🕴️
up
View GitHub Profile
@saadbinakhlaq
saadbinakhlaq / SSL_CERTBOT.md
Created January 18, 2026 19:49 — forked from HugaidaS/SSL_CERTBOT.md
Install SSL on EC2 with Certbot

This instruction will help you to install SSL certificate on your server using Certbot

1. Create an elastic IP for the EC2 instance you are integrating.

  1. Click Allocate new address in the Elastic IPs page.
  2. Then, click Allocate in the next page.
  3. Right-click the row of the newly created elastic IP, and click Associate address.
  4. Choose the EC2 instance you are integrating.

2. Create a DNS record for the domain you are integrating (GoDaddy in this example).

=begin
Write a function, largest_component, that takes in the adjacency list of an undirected graph.
The function should return the size of the largest connected component in the graph.
5
| \
| \
1-- 0 -- 8
4 -- 2
\ /
=begin
Write a function, connected_components_count, that takes in the adjacency list of an undirected graph.
The function should return the number of connected components within the graph.
=end
# 1 - 2
# 4
# |
# 5 -- 6 -- 8
# |
# 7
=begin
Write a function, undirected_path, that takes in a list of edges for an undirected graph and two nodes (node_A, node_B).
The function should return a boolean indicating whether or not there exists a path between node_A and node_B.
=end
edges = [
['i', 'j'],
['k', 'i'],
['m', 'k'],
['k', 'l'],
=begin
Write a function, has_path, that takes in a dictionary representing the adjacency list of a directed acyclic graph and two nodes (src, dst).
The function should return a boolean indicating whether or not there exists a directed path between the source and destination nodes.
=end
graph = {
'f' => ['g', 'i'],
'g' => ['h'],
'h' => [],
'i' => ['g', 'k'],
@saadbinakhlaq
saadbinakhlaq / apartment_search_berlin.md
Last active July 10, 2017 09:45
Overview of apartment search in Berlin
module BSON
class ObjectId
def to_json(*args)
to_s.to_json
end
def as_json(*args)
to_s.as_json
end
end
require 'spec_helper'
describe KV do
describe '#set' do
it 'assigns a value to the instance variable hash' do
kv = KV.new
kv.set('foo', 'bar')
expect(kv.hash['foo'][Time.now.to_i]).to eq('bar')
end
end
Dir[File.dirname(__FILE__) + '/application/*.rb'].each { |file| require file }
class KV
attr_reader :hash
def initialize
@hash = Hash.new { |h, k| h[k] = {} }
end
def set(key, value)
@hash[key][Time.now.to_i] = value