Skip to content

Instantly share code, notes, and snippets.

View tareksamni's full-sized avatar
🙂

Tarek N. Elsamni tareksamni

🙂
View GitHub Profile

Keybase proof

I hereby claim:

  • I am tareksamni on github.
  • I am tareksamni (https://keybase.io/tareksamni) on keybase.
  • I have a public key whose fingerprint is C0DB 7A03 2B16 0ED1 BFA7 2C81 BC08 DF8C 3992 E6C0

To claim this, I am signing this object:

@tareksamni
tareksamni / sort.rb
Last active September 28, 2017 19:55
Yelp online question
# Input:
businesses = [
{ rating: 1, id: 1000 },
{ rating: 4, id: 1020 },
{ rating: 5, id: 1300 },
{ rating: 5, id: 1040 },
{ rating: 9, id: 1005 },
{ rating: 2, id: 1104 },
{ rating: 3, id: 1400 }
]
@tareksamni
tareksamni / problem.md
Last active March 8, 2017 11:44
Just another interview question that I had to code in Ruby :)

Just another interview problem ..

Given the following code:

def bst_distance(values, n, node1, node2)
  # write you code here
end
@tareksamni
tareksamni / run.rb
Last active March 8, 2017 09:35
check balanced brackets
# Just another easy interview question in Ruby
# Description: https://www.hackerrank.com/challenges/balanced-brackets
# This solution is also expecting other chars other than the brackets
POSSIBLE_BRACKETS = %w({ } [ ] < > \( \)).freeze
MATCHING_BRACKETS = {
'{' => '}',
'[' => ']',
'<' => '>',
'(' => ')'
}.freeze
@tareksamni
tareksamni / docker-compose.yml
Created February 23, 2017 13:26
Example of using docker-compose health checks
version: '2.1'
services:
db:
image: bla_bla:1234/mysql:5.6
environment:
- MYSQL_ROOT_PASSWORD=XXXX
- MYSQL_DATABASE=bla_bla_dev
- MYSQL_USER=XXXX
- MYSQL_PASSWORD=XXXX
ports:
@tareksamni
tareksamni / sidekiq.config
Last active March 8, 2016 08:59
AWS Elastic BeansTalk configuration to run Sidekiq after each deployment
## For more details refer to: http://tsamni.com/post/84515089035/sidekiq-performing-background-or-delayed-jobs-with
## .ebextensions/sidekiq.config
commands:
create_post_dir:
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq":
mode: "000777"
content: |
@tareksamni
tareksamni / redis.yml
Last active August 29, 2015 14:00
Sidekiq Initializer base on current active environment
## For more details refer to: http://tsamni.com/post/84515089035/sidekiq-performing-background-or-delayed-jobs-with
# config/redis.yml
# Redis db configuration file
# development environment
development:
host: 'localhost'
port: '6379'
# local testing environment
test: