Skip to content

Instantly share code, notes, and snippets.

View khanha2's full-sized avatar
💭
I may be slow to respond.

Khanh Nguyen khanha2

💭
I may be slow to respond.
View GitHub Profile
@khanha2
khanha2 / gist:b8952e3619d3c6e8acc22fd9b6ab85ee
Created August 10, 2016 01:36 — forked from evildmp/gist:3094281
Set up Django, nginx and uwsgi

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@khanha2
khanha2 / residual_network.py
Created March 7, 2019 08:53 — forked from mjdietzx/residual_network.py
Clean and simple Keras implementation of residual networks (ResNeXt and ResNet) accompanying accompanying Deep Residual Learning: https://blog.waya.ai/deep-residual-learning-9610bb62c355.
"""
Clean and simple Keras implementation of network architectures described in:
- (ResNet-50) [Deep Residual Learning for Image Recognition](https://arxiv.org/pdf/1512.03385.pdf).
- (ResNeXt-50 32x4d) [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/pdf/1611.05431.pdf).
Python 3.
"""
from keras import layers
from keras import models
@khanha2
khanha2 / dfs.exs
Created June 3, 2022 09:43
Depth first search algorithm with Elixir
defmodule DFS do
@moduledoc """
Depth first search algorithm
Example
vertices = %{
0 => [1, 3],
1 => [0, 2],
2 => [1, 3],
@khanha2
khanha2 / bfs.exs
Created June 3, 2022 09:53
Breadth first search algorithm with elixir
defmodule BFS do
@moduledoc """
Breadth first search algorithm
Example
vertices = %{
0 => [1, 3],
1 => [0, 2],
2 => [1, 3],
@khanha2
khanha2 / find_hamiltonian_cycle.exs
Created June 3, 2022 10:13
Find Hamiltonian cycle algorithm with Elixir
defmodule HamiltonianCycle do
@moduledoc """
Find Hamiltonian cycle algorithm
Example
vertices = %{
0 => [1, 2],
1 => [0, 2, 3],
2 => [0, 1, 4],
@khanha2
khanha2 / randomizer.py
Last active February 20, 2023 14:25
Randomize with probability list
import random
from typing import List, Tuple
class Randomizer:
MAX_VALUE = 100.0
# Xác suất xuất hiện phần tử (0 <= x <= 1), hoặc tỉ trọng đóng góp
# trong tổng số lần gọi của mỗi phần tử
@khanha2
khanha2 / analyze elixir enum at function.md
Last active January 20, 2024 06:41
How Enum.at work
@khanha2
khanha2 / apply anti corruption for domain driven design in elixir.md
Last active February 21, 2024 11:05
Apply Anti-Corruption for Domain-Driven Design in Elixir

Apply Anti-Corruption for Domain-Driven Design in Elixir

Abstract

This article introduces some Anti-Corruption approaches to support communication between domains (business group) in the Domain-Driven Design pattern while keeping business logic between them isolated.

Overview

Assume we apply DDD (Domain-Driven Design) for an e-commerce project with the following structure: