Skip to content

Instantly share code, notes, and snippets.

View mdaftab88's full-sized avatar

MD AFTAB mdaftab88

  • Bangalore
View GitHub Profile
@mdaftab88
mdaftab88 / deploy-django.md
Created June 22, 2022 18:51 — forked from rmiyazaki6499/deploy-django.md
Deploying a Production ready Django app on AWS

Deploying a Production ready Django app on AWS

In this tutorial, I will be going over to how to deploy a Django app from start to finish using AWS and EC2. Recently, my partner Tu and I launched our app Hygge Homes (a vacation home rental app for searching and booking vacation homes based off Airbnb) and we wanted to share with other developers some of the lessons we learned along the way.

Following this tutorial, you will have an application that has:

  • An AWS EC2 server configured to host your application
  • SSL-certification with Certbot
  • A custom domain name
  • Continuous deployment with Github Actions/SSM Agent
Billing Issue
# select distinct account_id , payment_subscription_id from billing_units bu where
# (
# (
# location_associated_at between '2021-05-20 01:00:00' and '2021-05-27 01:00:00'
# ) or
# (
# archival_scheduled_at between '2021-05-20 01:00:00' and '2021-05-27 01:00:00'
@mdaftab88
mdaftab88 / sc
Last active May 23, 2021 17:55 — forked from jtprince/sc
screenshot application
#!/usr/bin/env ruby
# sc - screenshot utility using imagemagick 'import'
# Aftab: See this link: https://qr.ae/pGyZ0V
require 'optparse'
require 'ostruct'
require 'shellwords'
require 'fileutils'
viewers = {
@mdaftab88
mdaftab88 / gist:387498332d2c3d267c644f14a362c6c6
Created May 5, 2021 15:03 — forked from ryansobol/gist:5252653
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@mdaftab88
mdaftab88 / til.md
Last active May 7, 2021 13:41
Today I Learned....

TIL - Today I Learned

Sunday, 25 April 2021

Rails Polymorphic Associations

Sunday, 02 May 2021

  1. How to give a line break in a markdown file
    Just add two spaces at the end of the line. It worked for me. :)
  2. BEGIN in Ruby.
@mdaftab88
mdaftab88 / til.md
Created April 24, 2021 22:01 — forked from jplong91/til.md
Today I Learned...

TIL - Today I Learned

Wednesday, 11/20/19

Explaining require and permit: params.require(:person).permit(:name, :age)

The params in a controller looks like a Hash, but it's actually an instance of ActionController::Parameters, which provides several methods such as require and permit.

The require method ensures that a specific parameter is present, and if it's not provided, the require method throws an error. It returns an instance of ActionController::Parameters for the key passed into require.

@mdaftab88
mdaftab88 / RubyObjectModel.md
Created April 4, 2021 18:56 — forked from dmlaziuk/RubyObjectModel.md
Ruby Object Model

Ruby Object Model

Ruby version 2.4.1

BasicObject

 > BasicObject.public_instance_methods(false)
 => [:!, :==, :!=, :__send__, :equal?, :instance_eval, :instance_exec, :__id__]
@mdaftab88
mdaftab88 / GoogleAuthenticationCurl.sh
Created January 14, 2021 05:47 — forked from LindaLawton/GoogleAuthenticationCurl.sh
Curl bash script for getting a Google Oauth2 Access token
# Client id from Google Developer console
# Client Secret from Google Developer console
# Scope this is a space seprated list of the scopes of access you are requesting.
# Authorization link. Place this in a browser and copy the code that is returned after you accept the scopes.
https://accounts.google.com/o/oauth2/auth?client_id=[Application Client Id]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=[Scopes]&response_type=code
# Exchange Authorization code for an access token and a refresh token.
curl \
<command>
<ident value="only_if">
<pos line="38" column="2"/>
</ident>
<args_add_block value="false">
<args_add>
<args_new/>
<string_literal>
<string_add>
<string_add>
@mdaftab88
mdaftab88 / gist:a55124d3bf85e812f165723d93180e99
Created December 27, 2019 05:20 — forked from HashNuke/gist:608259
to undo push and commits
# to undo a git push
git push -f origin HEAD^:master
# to get to previous commit (preserves working tree)
git reset --soft HEAD
# to get back to previous commit (you'll lose working tree)
git reset --hard HEAD^