Skip to content

Instantly share code, notes, and snippets.

View maitrungduc1410's full-sized avatar
💪
Keep chasing your dreams!

Duc Trung Mai maitrungduc1410

💪
Keep chasing your dreams!
View GitHub Profile
@maitrungduc1410
maitrungduc1410 / .env
Last active March 2, 2025 23:13
Docker compose HEALTHCHECK for MongoDB with authentication (Mongo V4,5,6 supported)
DB_HOST=db
DB_PORT=27017
DB_ROOT_USER=root
DB_ROOT_PASS=rootpass
DB_USER=user
DB_PASSWORD=userpass
DB_NAME=mydb
@maitrungduc1410
maitrungduc1410 / create-vod-hls.sh
Last active February 28, 2025 00:48
Bash scripts to create VOD HLS stream with ffmpeg (Extended version)
#!/usr/bin/env bash
START_TIME=$SECONDS
set -e
echo "-----START GENERATING HLS STREAM-----"
# Usage create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]
[[ ! "${1}" ]] && echo "Usage: create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]" && exit 1
# comment/add lines here to control which renditions would be created
renditions=(
@maitrungduc1410
maitrungduc1410 / create-vod-hls-gpu.sh
Last active February 2, 2025 04:53
Bash scripts to create VOD HLS stream with ffmpeg using GPU
#!/usr/bin/env bash
START_TIME=$SECONDS
set -e
echo "-----START GENERATING HLS STREAM-----"
# Usage create-vod-hls-gpu.sh SOURCE_FILE [OUTPUT_NAME]
[[ ! "${1}" ]] && echo "Usage: create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]" && exit 1
# comment/add lines here to control which renditions would be created
renditions=(
@maitrungduc1410
maitrungduc1410 / blog.md
Created December 2, 2024 14:28
[ARCHIVE] Dockerize ứng dụng chat realtime với Laravel, Nginx, VueJS, Laravel Echo, Redis, SocketIO

Cập nhật gần nhất: 10/11/2024

Xin chào các bạn đã quay trở lại với series Học Docker và CICD của mình.

Chúc mọi người một mùa giáng sinh an lành ấm áp 😍😍

Mấy ngày vừa rồi tinh thần viết blog đang lên cao thì đôi mắt mình lại đình công sau 1 khoảng thời gian ngồi máy tính quá nhiều, hôm nay "cửa sổ tâm hồn" có vẻ tốt trở lại thì mình lại chầm chậm viết blog tiếp cho mọi người ;)

Dù làm gì cũng phải nhớ giữ sức khoẻ nhé mọi người, Tết nhất đến nơi rồi phải có sức khoẻ để còn đi làm lấy tiền đưa về biếu thầy bu 🤣🤣

Ở bài trước mình đã hướng dẫn các bạn các Dockerize ứng dụng NodeJS với mysql, redis,... cùng với đó là các setup cho môi trường dev và production.

@maitrungduc1410
maitrungduc1410 / App.js
Last active November 24, 2024 14:43
React-native-sound. Play audio from URL
import React, {Component} from 'react';
import {SafeAreaView, Text, View, Alert, Button, Switch} from 'react-native';
import Sound from 'react-native-sound';
class App extends Component {
constructor(props) {
super(props);
Sound.setCategory('Playback', true); // true = mixWithOthers
@maitrungduc1410
maitrungduc1410 / ChatItem.vue
Last active October 28, 2023 08:20
ChatLayout and ChatItem, chat.blade.php
<template>
<div class="message">
<div class="message-item user-name">
MTD
</div>
<div class="message-item timestamp">
| 11:21:32:
</div>
<div class="message-item text-message">
Hello how are you
@maitrungduc1410
maitrungduc1410 / Dockerfile
Created October 22, 2023 03:38
Docker Centos Nginx JWT
FROM quay.io/sclorg/nginx-120-c8s as base
FROM base as builder
USER root
ARG JWT_MODULE_PATH=/usr/local/lib/ngx-http-auth-jwt-module
ARG LIBJWT_VERSION=1.13.1
ARG NGINX_VERSION=1.20.0
@maitrungduc1410
maitrungduc1410 / docker-compose.yml
Created November 4, 2020 03:00
Docker PHP Nginx without mouting source code to Nginx
version: '3.4'
services:
app:
image: php:7.2-fpm-alpine
restart: unless-stopped
volumes:
- ./:/var/www/html
- ./www.conf:/usr/local/etc/php-fpm.d/www.conf
webserver:
@maitrungduc1410
maitrungduc1410 / middleware.ts
Created July 8, 2023 03:40
Sync session between Next Auth and Keycloak
import { withAuth } from "next-auth/middleware";
export default withAuth(
{
pages: {
signIn: "/auth/signin",
},
callbacks: {
authorized: async ({ token }) => {
if (!(token as any)?.id_token) return false;
@maitrungduc1410
maitrungduc1410 / package.json
Last active March 2, 2023 23:23
Update Npm and SonarQube on Git commit (using Husky)
{
"name": "demo-project",
"version": "0.0.3",
"husky": {
"hooks": {
"pre-commit": "npm --no-git-tag-version version patch && sh updateSonarProps.sh && git add ."
}
}
}