Skip to content

Instantly share code, notes, and snippets.

View emadpres's full-sized avatar

Emad Aghajani emadpres

View GitHub Profile
@emadpres
emadpres / memory_handler.cpp
Last active July 6, 2019 22:50
A custom C++ memory handler: Overloading new/delete for (1) a class, and (2) globally
// Source: C++ Game Development Primer - Chapter 1
#include <iostream>
using namespace std;
class DummyClass{
double a,b;
public:
@emadpres
emadpres / Observer.cpp
Created July 6, 2019 22:47
Observer Pattern - C++
// Source: C++ Game Development Primer - Chapter 2
#include <vector>
#include <algorithm>
#include <iostream>
/*
* Step 1: Generic Observer Pattern
*/
template <typename Observer>
@emadpres
emadpres / tomcat-macos-install.md
Last active December 2, 2024 17:32
Installing Tomcat on MacOS

Install Tomcat (Source)

Prerequisite: Java

UPDATE: It seems the IntelliJ bundled java is suffient. So skip first two steps and don't mind java -version and echo $JAVA_HOME are not working.

  1. Check java -version. Tomcat 9.x requires Java 8 or later.

    java version "13.0.2" 2020-01-14

@emadpres
emadpres / Scripts: Git
Last active February 17, 2021 23:17
Shell scripts related to git repositories: (1) Given a list (of repos): copy/delete, (2) Given a list of repos clone/pull #script #git
Gist Title
@emadpres
emadpres / Scripts: Maven and Pom.xml
Last active July 10, 2020 15:57
Shell scripts related to Maven and pom.xml: (1) Given a project generate "epom.xml", (2) Given a project extract dependencies #script #git
Gist Title
@emadpres
emadpres / docker-compose.yml
Last active January 26, 2021 15:38
Reverse Proxy with traefik + docker
version: '3'
# Maintainer: Emad Aghajani
# Source and guideline: https://gist.github.com/emadpres/e21c09f56829fa7a84ebf78ed7ad4fe1
services:
reverseproxy:
image: traefik:v2.0
container_name: reverseproxy
# Enables the web UI + tells Traefik to listen to docker + provide DEBUG-level logs
@emadpres
emadpres / TextFormatter.py
Last active June 3, 2022 02:56
Python Text Formatter for colorizing log
from enum import Enum
from typing import Final
class TextFormatter:
"""
Info Point
- How to colorize "text"? FORMATTING_SEQ+"text"+RESET_SEQ
- What's FORMATTING_SEQ? "\033[1;44m"
- "\033": The 033 (octal) or \x1b (hexadecimal) are equivalents for 27 that is the escape character code.