Skip to content

Instantly share code, notes, and snippets.

View prezire's full-sized avatar

Mark N. Amoin prezire

View GitHub Profile
@prezire
prezire / docker-compose.yml
Created June 24, 2023 03:02 — forked from nnattawat/docker-compose.yml
Docker setup for Drupal with bootstrap theme
version: "2"
services:
drupal:
build:
context: .
dockerfile: drupal.Dockerfile
image: custom-drupal
ports:
- 8080:80
<?php
/*
Rule-based pattern + Open/close principle.
Good for nested if-else statements especially on automation.
https://stackoverflow.com/questions/16849656/design-pattern-to-implement-business-rules-with-hundreds-of-if-else-in-java
*/
// Do not modify. Just extend or convert to a plugin.
interface SatisfiableContract
{
@prezire
prezire / django_cheat_sheet.md
Created March 25, 2021 12:16 — forked from bradtraversy/django_cheat_sheet.md
Django command cheat sheet

Django 2.x Cheat Sheet

Creating a virtual environment

We need to create a virtual env for our app to run in: More Here Run this command in whatever folder you want to create your venv folder

python -m venv ./venv
@prezire
prezire / django_deploy.md
Created March 25, 2021 08:50 — forked from bradtraversy/django_deploy.md
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.

#!/usr/bin/php-zts
<?php
# By: https://github.com/zheltikov
# Used in: https://www.youtube.com/watch?v=L_FdpmJatdw
# Define a custom Thread class
class MyThread extends Thread {
private $name = "";
private $duration = 0;
#!/bin/bash
# By: https://github.com/zheltikov
# Based on: http://blog.programster.org/ubuntu16-04-compile-php-7-2-with-pthreads
# Used in: https://www.youtube.com/watch?v=L_FdpmJatdw
# Download the necessary packages
sudo apt update
sudo apt install libzip-dev bison autoconf build-essential pkg-config git-core libltdl-dev libbz2-dev libxml2-dev libxslt1-dev libssl-dev libicu-dev libpspell-dev libenchant-dev libmcrypt-dev libpng-dev libjpeg8-dev libfreetype6-dev libmysqlclient-dev libreadline-dev libcurl4-openssl-dev
@prezire
prezire / docker_cheat_sheet.sh
Last active November 4, 2022 14:32
Docker commands
Ref:
https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes
Remove all:
docker system prune -a
Images:
Remove all:
docker rmi $(docker images -a -q)
@prezire
prezire / git_submodule.txt
Created October 23, 2019 07:28
Basic Git Submodule Commands
#Main proj.
#Add a submodule.
git submodule add https://proj.git
#Go to submodule's dir and change to specific branch.
cd submodule_dir
git checkout -b branch origin/branch
#Go back to proj root and push to repo along with the new submodule's new branch.
git add . -u
git commit ...
git push
@prezire
prezire / laravel_log_helper.php
Last active November 4, 2022 14:30
Proper use of logger.
<?php namespace App\Services\Enums;
final class LogType
{
const
//Total failures. Major systems are unavailable.
EMERGENCY_UNUSABLE_SYSTEMS = 'emergency',
//Usable hardwares with unusal outputs such as website down, unavailable DBs.
ALERT_CORRUPTED_SYSTEMS = 'alert',
@prezire
prezire / git-log-live
Last active January 22, 2019 03:21 — forked from tlberglund/git-loglive
Log Live Git Command
#!/bin/bash
#sudo ln -s /full-path/git-log-live /usr/local/bin/git-log-live
#sudo chmod +x git-log-live
#git-log-live /absolute-proj-root-path
#git-log-live .
while :
do
clear