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 May 7, 2023 03:27
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-gpu.sh
Last active September 2, 2023 08:54
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 / Example.vue
Created July 11, 2020 15:50
Vue beforeDestroy example
<template>
<div class="container">
<div>
<button @click="toggleMouse">Toggle Mouse</button>
</div>
<Mouse v-if="isMouseVisible" />
</div>
</template>
<script>
@maitrungduc1410
maitrungduc1410 / create-vod-hls.sh
Last active March 1, 2024 22:29
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 / app.js
Last active May 27, 2020 08:55
Editorjs
import React, { useRef } from 'react';
import EditorJS from '@editorjs/editorjs'
const App = () => {
const editor = useRef()
const init = () => {
if (!editor.current) {
editor.current = new EditorJS({
holder: 'editorjs',
@maitrungduc1410
maitrungduc1410 / data.json
Last active May 10, 2020 11:10
Data sample for VueJS blog
[
{
"gender": "male",
"name": {
"title": "Mr",
"first": "Apostolos",
"last": "Blohm"
},
"location": {
"street": {
@maitrungduc1410
maitrungduc1410 / nginx.conf
Created February 17, 2020 05:25
Nginx forward request to Docker container
server {
#root /var/www/html/portfolio/public;
server_name jamesisme.com www.jamesisme.com;
if ($host = jamesisme.com) {
return 301 https://www.jamesisme.com$request_uri;
}
location / {
@maitrungduc1410
maitrungduc1410 / Dockerfile
Created December 27, 2019 12:10
Docker nginx
FROM debian:buster-slim
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
ENV NGINX_VERSION 1.17.6
ENV NJS_VERSION 0.3.7
ENV PKG_RELEASE 1~buster
RUN set -x \
# create nginx user/group first, to be consistent throughout docker variants
@maitrungduc1410
maitrungduc1410 / index.html
Last active November 6, 2019 09:26
Change Bootstrap tooltip content dynamically on click button
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>tooltip</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
@maitrungduc1410
maitrungduc1410 / App.js
Last active June 1, 2020 02:37
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