Skip to content

Instantly share code, notes, and snippets.

View nvtuan305's full-sized avatar
:shipit:
Hello!

Tuan Nguyen nvtuan305

:shipit:
Hello!
  • Ho Chi Minh city, Vietnam
View GitHub Profile
@nvtuan305
nvtuan305 / normalize_string.go
Created December 4, 2020 08:40
golang: normalize string (include Vietnamese)
package main
import (
"fmt"
"golang.org/x/text/runes"
"golang.org/x/text/transform"
"golang.org/x/text/unicode/norm"
"strings"
"unicode"
)
package main
import (
"fmt"
"errors"
"testing"
"github.com/stretchr/testify/assert"
)
type User struct {
@nvtuan305
nvtuan305 / nothing1.go
Created December 16, 2018 09:08
Nothing
package main
import "fmt"
// Are you ready? :D
func readyToGo() bool {
return true
}
func main() {
@nvtuan305
nvtuan305 / zsh.md
Created November 26, 2018 07:46 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
@nvtuan305
nvtuan305 / FirebaseConfig.java
Created November 16, 2018 10:19
Firebase Admin SDK configuration
import com.google.auth.oauth2.GoogleCredentials;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ResourceLoader;
import java.io.InputStream;
@nvtuan305
nvtuan305 / dlf-detect-intent.js
Created June 5, 2018 03:02
Detect Dialogflow intent that supports multiple agents using API v2
'use strict';
// @ts-ignore
const dialogflow = require('dialogflow');
const fs = require('fs');
/**
* Detect dialogflow intent
* @param {String} botId
* @param {String} sessionId
@nvtuan305
nvtuan305 / visual-studio-code-config.txt
Created December 25, 2017 14:25
Visual Studio Code setting configuration
{
// Editor settings
"editor.fontFamily": "'Roboto Mono', Consolas, 'Courier New', monospace",
"editor.fontSize": 15,
"editor.lineHeight": 21,
"editor.tabSize": 4,
"editor.detectIndentation": false,
"editor.rulers": [80],
// Theme settings
@nvtuan305
nvtuan305 / GetHashKeyForFacebookApp.java
Last active March 22, 2018 02:31
Get hash key for app on facebook developers page
private void getHashKey() {
try {
PackageInfo info = getPackageManager().getPackageInfo("your.package", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("Facebook Hash key: ", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (PackageManager.NameNotFoundException e) {