Skip to content

Instantly share code, notes, and snippets.

View manojnaidu619's full-sized avatar
🎯
Focusing

Manoj Kumar manojnaidu619

🎯
Focusing
  • Bangalore,India
View GitHub Profile
@manojnaidu619
manojnaidu619 / rails_deployment.md
Last active May 12, 2025 10:31
Rails deployment to AWS EC2

Rails Deployment to AWS EC2

Stack : (Nginx + Phusion Passenger + Postgresql)

  • Step -1

    To Launch an EC2 instance from aws console with all the credentials and configurations hooked.

  • Step-2

@manojnaidu619
manojnaidu619 / webdev_online_resources.md
Created November 13, 2019 02:19 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@manojnaidu619
manojnaidu619 / PaytmController.rb
Last active October 26, 2019 18:02
Controller file for Paytm integration in ROR (Edits required in line no's : 5, 264-273, 358)
class PaytmController < ApplicationController
skip_before_action :verify_authenticity_token
def paytm
@checksum = new_pg_checksum(params, MERCHANT_KEY) # MERCHANT_KEY = your Merchant key
end
def handle_payment
if params["CHECKSUMHASH"]
paytmHash = Hash.new
@manojnaidu619
manojnaidu619 / contentful.rb
Created October 2, 2019 00:47
Contentful Ruby SDK usage
require 'contentful'
client = Contentful::Client.new(
space: '<spacd_id>',
access_token: '<access-token>',
dynamic_entries: :auto
)
entries = client.entries # For grabbing entries
entries.each do |entry|
@manojnaidu619
manojnaidu619 / complex-number-friend.cpp
Created September 12, 2019 17:25
Calculating Complex number using Friend Function in CPP
#include <iostream>
using namespace std;
class Complex{
int real,img;
public:
Complex(int real=0, int img=0){
this->real = real;
this->img = img;
}
@manojnaidu619
manojnaidu619 / pointer-to-a-function.cpp
Last active August 30, 2019 17:11
Pointer to a function in CPP
#include <iostream>
using namespace std;
int give_max(int x, int y){
return x>y ? x : y;
}
int main(){
int (*f)(int,int); // Pointer declaration
f = give_max; // Pointer initialization with the function name
@manojnaidu619
manojnaidu619 / level order traversal.rb
Created August 29, 2019 01:38
BFS/Level order Traversal in Ruby
def level_order(root)
result, queue = [], []
return result if !root
queue << root
result << [root.val]
while !queue.empty?
len = queue.length
count = 0
inter = []
len.times do
@manojnaidu619
manojnaidu619 / Binary_Tree.cpp
Created August 18, 2019 07:19
Binary Tree creation in CPP
#include <iostream>
#include <queue>
using namespace std;
struct Node {
int data;
struct Node * left;
struct Node * right;
}*root=NULL;
@manojnaidu619
manojnaidu619 / level_order_traversal.cpp
Created August 8, 2019 04:58
BFS / Level order Traversal in CPP
queue<TreeNode*> q; // To store the node addresses
vector<int> result; // To store the values in the node
result.push_back(root->val);
q.push(root);
while (!q.empty()) {
node = q.front();
q.pop();
if(node->left){
result.push_back(node->left->val);
q.push(node->left);
@manojnaidu619
manojnaidu619 / football.rb
Created August 2, 2019 10:01
Codechef solution for problem "Football" (problem code: MSNSADM1) in Ruby
goal,foul,size,points,seg = [],[],[],[],[]
n = gets.to_i
n.times do
size << gets.to_i
g = gets.strip.split(/\s+/).map(&:to_i)
goal << g
f = gets.strip.split(/\s+/).map(&:to_i)
foul << f
end