Skip to content

Instantly share code, notes, and snippets.

View vvvhung's full-sized avatar

louis vvvhung

  • Ho Chi Minh City
View GitHub Profile
@vvvhung
vvvhung / embedded-file-viewer.md
Created November 1, 2020 01:54 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@vvvhung
vvvhung / access_postgresql_with_docker.md
Created October 25, 2019 06:56 — forked from MauricioMoraes/access_postgresql_with_docker.md
Allow Docker Container Access to Host's Postgres Database on linux (ubuntu)

You have to do 2 things in order to allow your container to access your host's postgresql database

  1. Make your postgresql listen to an external ip address
  2. Let this client ip (your docker container) access your postgresql database with a given user

Obs: By "Host" here I mean "the server where docker is running on".

Make your postgresql listen to an external ip address

Find your postgresql.conf (in case you don't know where it is)

$ sudo find / -type f -name postgresql.conf

@vvvhung
vvvhung / validate-url.js
Created September 23, 2019 02:25 — forked from foxted/validate-url.js
Validate a URL to add http if needed (VueJS)
validateUrl() {
let regex = /^(http|https)/;
if(this.url.length > 3 && !this.url.match(regex)) {
this.url = 'http://' + this.url;
}
}
class Connection:
config = None
conn = None
def __init__(self, config):
self.parse_config(config)
def parse_config(self, config):
pass
@vvvhung
vvvhung / multi-git-win.md
Created January 2, 2019 10:17 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer on Mac OS. Now with a guide for Windows 10.

Setting up github and bitbucket on the same computer (Windows)

Guide for Windows

mix3d asked for some help using this guide with windows so here we go. This was tested with Windows 10. Run all commands in Git Bash once it's installed.

Github will be the main account and bitbucket the secondary.

Git for Windows

  • Download and install Git for Windows
  • In the installer, select everything but decide if you want a desktop icon (2nd step)
@vvvhung
vvvhung / config.py
Created July 12, 2018 09:32
Window service python
import os
config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.txt")
config = {}
f = open(config_file, 'r')
for line in f:
if line.strip()[0] != '#':
sep = line.find(":")
key = line[:sep].strip()
val = line[sep+1:].strip()
config[key] = val
@vvvhung
vvvhung / index.html
Created June 23, 2017 11:15
corr plot
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
.line {
@vvvhung
vvvhung / index.html
Last active June 23, 2017 10:56
cumulative plot
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
.line {
@vvvhung
vvvhung / index.html
Last active June 23, 2017 10:36
percentage category
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
<script src="https://d3js.org/d3.v4.min.js"></script>
</head>
<body>