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 / 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
@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
@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 / angular.json
Last active September 25, 2022 03:15
Angular (NGX) Intro.js
{
"projects": {
"ngx-introjs": {
"architect": {
"build": {
"options": {
"styles": [
"node_modules/intro.js/introjs.css"
],
"scripts": [
@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 / index.js
Last active December 27, 2022 03:25
Import users from OpenEdx to Keycloak with NodeJS
import KcAdminClient from "@keycloak/keycloak-admin-client";
const kcAdminClient = new KcAdminClient({
baseUrl: "http://localhost:8080",
realmName: "myrealm",
});
const credentials = {
grantType: "password",
username: "superuser",
@maitrungduc1410
maitrungduc1410 / _silent-check-sso.html
Created January 4, 2023 04:13
Openedx Keycloak federated login (SSO)
<html>
<body>
<script>
parent.postMessage(location.href, location.origin)
</script>
</body>
</html>
@maitrungduc1410
maitrungduc1410 / _silent-check-sso.html
Last active January 4, 2023 04:18
Openedx Keycloak Federated Logout (Single sign out)
<html>
<body>
<script>
parent.postMessage(location.href, location.origin)
</script>
</body>
</html>
@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 / .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