Skip to content

Instantly share code, notes, and snippets.

@agusmakmun
Last active November 1, 2020 23:32
Show Gist options
  • Save agusmakmun/f4880503a60c08ae58d20af17bf4b099 to your computer and use it in GitHub Desktop.
Save agusmakmun/f4880503a60c08ae58d20af17bf4b099 to your computer and use it in GitHub Desktop.
Interview
  1. Introduction about yourself.

Let me introduce my self, My name is Agus Makmun, and I was 26 years old. I come from South Sumatera, indonesia. And I was bachelor's degree in computer science at university muhammadiyah of surakarta.

I have exposure working every aspect of the software development with Python, Django, Rest API, Web Development, AWS (Lightsail, S3, EC2, RDS), Digital Ocean, Python Anywhere, other VPS Deployment, Microservices & Legal Scraping.

  1. Experiences in using Django & unit testing

I have used the Django more than 5 years. I also created some open source projects that founds at https://github.com/agusmakmun For Unit Testing, I'm using standard module from python called with "unittest", also "django unittest".

  1. Tools / Tech that you used for example Django (how many years have you've been using the tools, how many projects you've handled before, etc)

Years: I have using this Django for more than 5 years.

Tools: anyway, I also love to create the modules for python & django. you can directly check my tools at https://pypi.org/user/agaust

But, I also use the another tools depends with the projects. It's like: Standard python module, Google Suit & https://postmarkapp.com for E-mail, zenziva for sms, https://midtrans.com, nicepay.co.id for payment gateway. Celery for cron jobs. sentry.io for error tracking. MongoDB, MysqlDB, PostgreSQL for the database. requests, BeautifulSoup, NLTK, OpenCV, Jupyter, Nginx, Postman, many others.

Django: Django rest framework, django-allauth, celery, django-cms, django-suit, django-debug-toolbar, django-import-export, ckeditor, markdown editor, django log viewer, & many others. https://github.com/wsvincent/awesome-django

The websites I have done (maded and contributed), such as:

  1. https://titipbeliin.com - import services (buying the products from other countries to customers until his home).
  2. https://titipkirimin.com - import services (still similiar with titipbeliin, but it focused only for shipping services).
  3. https://plazadana.com - islamic retail equity based crowdfunding market place
  4. https://skripsi.ums.ac.id - Thesis Information System
  5. https://python.web.id - that was my blog written with django.
  6. https://www.penerbitpqs.com - official website for islamic book publisher.
  7. http://mitra.dapurpintar.com - Management Platform Based on Resto Kitchen Class (discontinued during covid-19)
  8. https://forum.dracos-linux.org - online forum for open source pentest OS (now it already changed)

and much more, I forgot how many sites I have done.

  1. Your achievements I am not very active in following competencies, so: My achievement is just one, as top 5th in "ProblemSet Competition from CodePolitan" at https://www.codepolitan.com

That was my short summary about my self. For more, you can take a look at my c.v file (pdf)

Introduction

Let me introduce my self, My name is Agus Makmun, 26 (tweenty six) years old. I come from south sumatera, indonesia. And I was bachelor's degree in computer science at university muhammadiyah of surakarta.

By the way, My english is not really good.

Previously, I have lost my jobs as a Backend Developer due to covid-19 & funding issues. And now I trying to search new opportunities.

I have exposure working every aspect of the software development with Python, Django, Rest API, Web Development, AWS (Lightsail, S3, EC2, RDS), VPS Deployment, Microservices & Legal Scraping.

That was my short summary about my self.

can you please, explain more detail about this company.

My expected salary around ten million ruphias (10 juta). OR
one thousand dollar ($1000) in Singapore currency.

Programming Test

1. OOP

https://www.tutorialspoint.com/python/python_classes_objects.htm

2. Bubble Sort

Bubble sort is a sorting algorithm that is used to sort items in a list in ascending order. This is done by comparing two adjacent values. If the first value is higher than the second value, then the first value takes the position of the second value while the second value takes the position that was previously occupied by the first value. If the first value is lower than the second value, then no swapping is done.

https://www.tutorialspoint.com/python-program-for-bubble-sort https://www.guru99.com/bubble-sort.html

def bubbleSort(ar):
   n = len(arr)
   # Traverse through all array elements
   for i in range(n):
     # Last i elements are already in correct position
     for j in range(0, n-i-1):
        # Swap if the element found is greater than the next element
        if ar[j] > ar[j+1] :
           ar[j], ar[j+1] = ar[j+1], ar[j]

# Driver code to test above
ar = ['t','u','t','o','r','i','a','l']
bubbleSort(ar)
print ("Sorted array is:")
for i in range(len(ar)):
   print (ar[i])
# Python program for implementation of Bubble Sort 
  
def bubbleSort(arr): 
    n = len(arr) 
  
    # Traverse through all array elements 
    for i in range(n-1): 
    # range(n) also work but outer loop will repeat one time more than needed. 
  
        # Last i elements are already in place 
        for j in range(0, n-i-1): 
  
            # traverse the array from 0 to n-i-1 
            # Swap if the element found is greater 
            # than the next element 
            if arr[j] > arr[j+1] : 
                arr[j], arr[j+1] = arr[j+1], arr[j] 
  
# Driver code to test above 
arr = [64, 34, 25, 12, 22, 11, 90] 
  
bubbleSort(arr) 
  
print ("Sorted array is:") 
for i in range(len(arr)): 
    print ("%d" %arr[i]),  

3. Palindrome

A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward, such as madam, racecar.

Palindrom adalah sebuah kata, frasa, angka maupun susunan lainnya yang dapat dibaca dengan sama baik dari depan maupun belakang

ada, apa, ara, asa, bab, ini, katak, kodok, makam, malam, radar, taat, tamat

def isPalindrome(x):
   val = str(x)
   return val == val[::-1]


def isPalindrome(word):
    # Loop over half the length of the string in question
    for l in range(round(len(word)/2)):
        # If the current letter is not equal to the letter
        # on the corresponding opposite of the string, return False       
        if word[l] != word[-(l+1)]: return False
    # If they all match, return True
    return True

4. Selection sort

https://www.w3resource.com/python-exercises/data-structures-and-algorithms/python-search-and-sorting-exercise-5.php

def selectionSort(nlist):
   for fillslot in range(len(nlist)-1,0,-1):
       maxpos=0
       for location in range(1,fillslot+1):
           if nlist[location]>nlist[maxpos]:
               maxpos = location

       temp = nlist[fillslot]
       nlist[fillslot] = nlist[maxpos]
       nlist[maxpos] = temp

nlist = [14,46,43,27,57,41,45,21,70]
selectionSort(nlist)
print(nlist)

5. QuickSort

Like Merge Sort, QuickSort is a Divide and Conquer algorithm. It picks an element as pivot and partitions the given array around the picked pivot. There are many different versions of quickSort that pick pivot in different ways.

https://www.geeksforgeeks.org/quick-sort/?ref=lbp

# Python program for implementation of Quicksort Sort 
  
# This function takes last element as pivot, places 
# the pivot element at its correct position in sorted 
# array, and places all smaller (smaller than pivot) 
# to left of pivot and all greater elements to right 
# of pivot 
def partition(arr,low,high): 
    i = ( low-1 )         # index of smaller element 
    pivot = arr[high]     # pivot 
  
    for j in range(low , high): 
  
        # If current element is smaller than the pivot 
        if   arr[j] < pivot: 
          
            # increment index of smaller element 
            i = i+1 
            arr[i],arr[j] = arr[j],arr[i] 
  
    arr[i+1],arr[high] = arr[high],arr[i+1] 
    return ( i+1 ) 
  
# The main function that implements QuickSort 
# arr[] --> Array to be sorted, 
# low  --> Starting index, 
# high  --> Ending index 
  
# Function to do Quick sort 
def quickSort(arr,low,high): 
    if low < high: 
  
        # pi is partitioning index, arr[p] is now 
        # at right place 
        pi = partition(arr,low,high) 
  
        # Separately sort elements before 
        # partition and after partition 
        quickSort(arr, low, pi-1) 
        quickSort(arr, pi+1, high) 

Devops adalah

DevOps is a culture that allows the development and the operations team to work together. This results in continuous development, testing, integration, deployment, and monitoring of the software throughout the lifecycle.

DevOps merupakan serangkaian pekerjaan yang mengotomasisasi proses antara development team & operation team. Sehingga menghasilkan pengembangan software yang berkelanjutan (continuous development), testing, integration, deployment, serta melakukan monitoring terhadap lifecycle yang sedang berlangsung.

devops1

devops2

devops3

Software devops

  1. Kubernetes => platform open source yang digunakan untuk manajemen container.
  2. Docker => sebagai containernya.
  3. Container => sebuah wadah yang digunakan untuk menyimpan sebuah sebuah software secara lengkap beserta semua dependensinya.
  4. Git
  5. Jenkins => software Continous Integration (seperti gitlab ci).
  6. Nagios => aplikasi monitoring jaringan
  7. Ansible => sebuah provisioning tool yang dikembangkan oleh RedHat.
  8. Git adalah salah satu sistem pengontrol versi (Version Control System) pada proyek perangkat lunak yang diciptakan oleh Linus Torvalds

Ansible adalah sebuah tool management untuk mengotomasi system ataupun network.

Jadi contohnya gini kita memiliki 10 server dan kemudian kita akan konfigurasi nginx, tanpa ansible kita akan membutuhlan waktu lama untuk konfigurasi itu karena kita harus satu satu masuk ke server yang ada dan menginstalmya satu satu.

ansible

Teknologi System Architecture yang digunakan

  1. Python sebagai bahasa pemrograman yang digunakan untuk backend service.
  2. Django sebagai web framework'nya.
  3. DRF (django-rest-framework) untuk API'nya.
  4. Vue sebagai front-end'nya.
  5. Jenkins sebagai Continous Integration'nya.
  6. Travis CI, Gitlab CI, Circle CI, code ship
  7. Email => G-Suit (bayar), https://postmarkapp.com
  8. SMS => zenziva.net
  9. Web Server => Nginx (with caching method)
  10. Payment Gateway => https://midtrans.com, nicepay.co.id
  11. Cron job => Celery
  12. Error tracking => sentry.io
  13. Database => Postgresql (RDS)
  14. Log => MongoDB
  15. Kubernetes platform open source yang digunakan untuk manajemen container.
  16. Docker sebagai containernya.
  17. Cache => django-redis-cache, django-redis (https://riptutorial.com/django/topic/4085/using-redis-with-django---caching-backend)
  18. Postman => API Docs.

Mengatasi High Requests

  1. Besarkan spesifikasi server machine (seperti: memory min 8gb, processor, storage)
  2. Optimasi pada Nginx'nya (menggunakan cache)
  3. Menggunakan proxy reverse
  4. Menggunakan load balancer
  5. Optimasi pada Django'nya:
    • menggunakan redis cache
    • pada database query, Django ORM'nya (contoh: select_related, prefetch_related)
  6. Mengimplementasikan microservices

Key notes

  1. VPC (Virtual private cloud) AWS
  2. ELB (Elastis Load Balancer) AWS
  3. Amazon Elastic Compute Cloud (Amazon EC2)
  4. Amazon Simple Storage Service (S3)
  5. RPC - Remote Procedure Calls (RPC) RPC adalah suatu protokol yang menyediakan suatu mekanisme komunikasi antar proses yang mengijinkan suatu program untuk berjalan pada suatu komputer tanpa terasa adanya eksekusi kode pada sistem yang jauh ( remote system ), Ini berbeda dengan REST. https://medium.com/programmer-geek/mengenal-rpc-remote-procedure-call-7d8a794bbd1f
  6. RabbitMQ merupakan message broker, seperti socket io. Ada beberapa merk message broker diantaranya RabbitMQ, Apache Kafka, ActiveMQ (JMS)

kafka vs rabitmq

Programming Tests

  1. https://github.com/leandrotk/algorithms important
  2. https://www.tutorialspoint.com/python/python_interview_questions.htm
  3. https://www.edureka.co/blog/interview-questions/python-interview-questions/#WhatisthedifferencebetweenlistandtuplesinPython?

  1. What are functions in Python? A function is a block of code which is executed only when it is called. To define a Python function, the def keyword is used.
  2. What is __init__? __init__ is a method or constructor in Python. This method is automatically called to allocate memory when a new object/ instance of a class is created. All classes have the __init__ method.
  3. What is a lambda function? An anonymous function is known as a lambda function. This function can have any number of parameters but, can have just one statement.
  4. Explain Inheritance in Python with an example Inheritance allows One class to gain all the members(say attributes and methods) of another class. Inheritance provides code reusability, makes it easier to create and maintain an application. The class from which we are inheriting is called super-class and the class that is inherited is called a derived / child class.
  5. How are classes created in Python? Class in Python is created using the class keyword.
  6. Define encapsulation in Python? Encapsulation means binding the code and the data together. A Python class in an example of encapsulation. https://medium.com/@manjuladube/encapsulation-abstraction-35999b0a3911

1. Backup file ke .tar.gz

tar -czvf file.tar.gz directory/ /directory2 --exclude=/home/path/ --exclude=*.mp4

dengan date;

# backupDate=`date +"%Y-%m-%d %T"`; # 2020-09-23 10:51:22

backupDate=`date+"%Y-%m-%d"`;


# fille yg di compile: webapps_2017-11-14.tar.gz

tar -czvf webapps_${backupDate}.tar.gz directory/

kasus lain;

#!/bin/bash

ORIGIN="/home/yourusername/projects/*"
DESTINATION="/media/yourusername/Elements/jobs/projects/"

if [ -d $DESTINATION ]; then
    rsync -a --exclude "*.pyc" $ORIGIN $DESTINATION;
    echo "Updated at:" $(date);
else
    echo "Path $DESTINATION not found.";
    echo "Not updated at:" $(date);
fi

Change mode for your bash file:

$ chmod +x autosync.sh

Don’t miss to add into cronjobs

$ crontab -e

then, in your editor:

# Select shell mode
SHELL=/bin/bash


# Setup to daily method.
# [minute] [hour] [date] [month] [year]
# sync the folders for every hours, for more: https://crontab.guru/every-1-hour
0 * * * * /home/yourusername/tools/autosync.sh > /yourusername/tools/autosync.log 2>&1
  1. https://github.com/library-collections/pytest-monitor
  2. https://kubernetes.io/id/docs/concepts/overview/object-management-kubectl/imperative-command/
  3. https://zakkymuhammad.com/blog/perintah-perintah-dasar-pada-docker-dan-contohnya/
  4. http://blog.gaza.my.id/2017/11/self-reminder-wawancara-posisi-devops.html
  5. https://id.bitdegree.org/tutorial/docker-tutorial/#heading-11
  6. https://phoenixnap.com/kb/how-to-install-docker-on-ubuntu-18-04
  7. https://www.simplilearn.com/tutorials/devops-tutorial/devops-interview-questions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment