Skip to content

Instantly share code, notes, and snippets.

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

agusmakmun

🏠
Working from home
View GitHub Profile
@agusmakmun
agusmakmun / upgrade-djstripe.md
Last active April 23, 2024 09:09
How to upgrade dj-stripe flawlessly?

Background

In this article, we will share how to upgrade the dj-stripe package flawlessly and carefully.

As we know, dj-stripe always squashes the migration files, which means its migration files are completely changed, and leading to migration issues.

So, you can't immediately upgrade your package too far, for example, from 2.4.0 to 2.7.0,
because it will cause breaking changes, especially in your database migrations.

@agusmakmun
agusmakmun / a_Docker setup.md
Created March 20, 2024 16:35 — forked from Swiss-Mac-User/a_Docker setup.md
Installing SonarQube on Docker and SonarScanner using Homebrew on macOS

Docker setup

Install the Docker UI application for macOS

brew install docker --cask

Open the Docker.app

from /Applications/Docker.app

Go to the Docker Dashboard

Wait until the "Docker Dashboard starting…"-message disappears (= Setup complete)

@agusmakmun
agusmakmun / 1.srp.py
Created December 22, 2022 14:36 — forked from dmmeteo/1.srp.py
SOLID Principles explained in Python with examples.
"""
Single Responsibility Principle
“…You had one job” — Loki to Skurge in Thor: Ragnarok
A class should have only one job.
If a class has more than one responsibility, it becomes coupled.
A change to one responsibility results to modification of the other responsibility.
"""
class Animal:
def __init__(self, name: str):
import operator
from collections import OrderedDict
from django.utils.translation import gettext_lazy as _
class EnumMetaClass(type):
def __init__(cls, name, bases, classdict):
def _human_enum_values(enum):
return cls.__choices__[enum]
@agusmakmun
agusmakmun / mac-cheat-sheet.md
Last active October 21, 2021 04:14
Mac Cheat Sheet
  1. Minimize app in dock: Opt + Click the icon app (https://apple.stackexchange.com/a/38201)
  2. Screenshot: ⌘ cmd + Shift + 3/4
  3. Record Screen: ⌘ cmd + Shift + 5 - https://support.apple.com/en-us/HT208721
  4. Set primary display: https://www.addictivetips.com/mac-os/set-the-primary-display-on-macos/
  5. GIF Screen Recorder: ???
  6. Set default editor to nano: https://unix.stackexchange.com/a/501863
  7. Resize window: https://www.theverge.com/2020/3/6/21168153/macos-catalina-windows-size-rearrange-how-to
  8. See all opened windows: System Preferences > Mission Control > Keyboard & Mouse Shortcuts => Mission Control : Left Option - https://support.apple.com/guide/mac-help/open-windows-spaces-mission-control-mh35798/mac
  9. make auto-hide/show for the dock faster - https://apple.stackexchange.com/a/46222 defaults write com.apple.dock autohide-time-modifier -float 0.5;killall Dock
@agusmakmun
agusmakmun / django-modify-admin-login-form.md
Last active November 13, 2024 03:59
Modify the default Django admin login form without modifying the entire models to new AdminSite

For example we want to modify the default login form with only add new reCAPTCHA feature. Ya, because previously I have an issue about brute forcing password to this page. So, we should add it reCAPTCHA to fix the fuln issue.

Option 1

We can just overwrite the default admin site from django.

  1. myapp/forms.py
@agusmakmun
agusmakmun / 1.permissions-haulier.json
Last active November 5, 2020 07:57
can be partial & FE doesn't need to send the "description" field because it read-only fields. Note: this valid format focused on "generalPermissions".
{
"dashboard": {
"generalPermissions": []
},
"scheduler": {
"generalPermissions": [
{
"code": "scheduler.add_plantrip",
"description": "Can add plan trip"
},
@agusmakmun
agusmakmun / 1.interview-voice.md
Last active November 1, 2020 23:32
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.

@agusmakmun
agusmakmun / test_views.py
Created May 8, 2020 06:57 — forked from dnmellen/test_views.py
How to create a unittest for a "View" Mixin (Django Testing)
from django.test import TestCase, RequestFactory
from django.views.generic import TemplateView
from ..lib.views import YourMixin
class YourMixinTest(TestCase):
'''
Tests context-data in a Django Mixin like a boss
'''
@agusmakmun
agusmakmun / notif-me.md
Created March 12, 2020 04:52
How to make a notification when terminal process is complete

I have started a long process through a terminal. Is it possible to make the Ubuntu terminal make a sound once the process is complete? This way, I don’t need to keep checking, but will instead be notified through a sound or another notification.

You can use this some alternatives;

$ your-bash-command && aplay /path/to/sound.wav  # can also with *.ogg file.