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 / 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 / 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 / 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 / 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-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 / .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 / client_2.py
Last active August 6, 2021 16:28
Kaldi Gstreamer Client for decoding from file and microphone (Python 2 and 3)
import argparse
from ws4py.client.threadedclient import WebSocketClient
import time
import threading
import sys
import urllib
import Queue
import json
import os
import datetime
@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 / 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 ."
}
}
}
@maitrungduc1410
maitrungduc1410 / client_3.py
Created December 9, 2020 02:26
Demo streaming audio data to Api-gateway
import argparse
from ws4py.client.threadedclient import WebSocketClient
import time
import threading
import sys
import urllib.parse
import queue
import json
import time
import os