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 / 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 / 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 / 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 / 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 / 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 / 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 / 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