Skip to content

Instantly share code, notes, and snippets.

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

Nanda Suhendra nandhasuhendra

🏠
Working from home
View GitHub Profile
#ruby 2.7.2
# Description:
# Galih and Ratna married during the COVID19 period
# and only invited the families of both parters.
# They rented a number of minibus to pick up all of
# their families to go to wedding. But during the COVID19,
# the government held a PSBB program to reduce the impact
# of the spread of the virus. Each minibus only can carry
# at most 4 passengers.
def counter(string)
{}.tap do |result|
string.each_char { |chr| result[chr] ? result[chr] += 1 : result[chr] = 1 }
end
end
def format_output(hash)
hash.each do |key, total|
puts "Huruf #{key} : #{total}"
end
def caesar(string, shift = 1)
alpha_num = 'abcdefghijklmnopqrstuvwxyz1234567890'.split('')
shifted = Hash[alpha_num.zip(alpha_num.rotate(shift))]
string.downcase.chars.map { |chr| shifted.fetch(chr, chr) }.join
end
50.times do |index|
puts caesar('dyvayv9 f6b dr5a a6 b5t6cv9 ayv 0vt9va0 6w ayv b5zcv90v, 69 f6b 1b0a dr5a a6 7b90bv r tr9vv9 z5 ayv ih0a tv5ab9f, sr0zt t647bav9 796x9r44z5x z0 r5 v00v5azr3 02z33 a6 3vr95 - 0av7yv5 yrd2z5x', index)
end
#!/bin/bash
ssh-keyscan -H heroku.com >> ~/.ssh/known_hosts
mkdir -p /usr/local/lib /usr/local/bin
tar -xvzf heroku-linux-amd64.tar.gz -C /usr/local/lib
ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
cat > ~/.netrc << EOF
machine api.heroku.com
login $HEROKU_LOGIN