Skip to content

Instantly share code, notes, and snippets.

View tienhieuD's full-sized avatar
🦶
hmmm

DUONG TIEN HIEU tienhieuD

🦶
hmmm
View GitHub Profile
@tienhieuD
tienhieuD / SchemaSpy-HOWTO.md
Created August 26, 2018 15:42 — forked from dpapathanasiou/SchemaSpy-HOWTO.md
How to use SchemaSpy to generate the db schema diagram for a PostgreSQL database

SchemaSpy is a neat tool to produce visual diagrams for most relational databases.

Here's how to use it to generate schema relationship diagrams for PostgreSQL databases:

  1. Download the jar file from here (the current version is schemaSpy_5.0.0.jar)

  2. Get the PostgreSQL JDBC driver (either the JDBC3 or JDBC4 jar file is fine)

  3. Run the command against an existing database. For most databases, the schema (-s option) we are interested in is the public one:

@tienhieuD
tienhieuD / SchemaSpy-HOWTO.md
Created August 26, 2018 15:42 — forked from dpapathanasiou/SchemaSpy-HOWTO.md
How to use SchemaSpy to generate the db schema diagram for a PostgreSQL database

SchemaSpy is a neat tool to produce visual diagrams for most relational databases.

Here's how to use it to generate schema relationship diagrams for PostgreSQL databases:

  1. Download the jar file from here (the current version is schemaSpy_5.0.0.jar)

  2. Get the PostgreSQL JDBC driver (either the JDBC3 or JDBC4 jar file is fine)

  3. Run the command against an existing database. For most databases, the schema (-s option) we are interested in is the public one:

@tienhieuD
tienhieuD / Select2-Custom-CSS.less
Created August 23, 2018 06:08
Select2 Custom CSS LESS
// Select2 Custom
.select2-container--default .select2-selection--single {
height: 48px;
text-align: left;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
padding: 10px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
import calendar
from datetime import datetime as date
def get_date_range(self, month, year):
last_day_of_month = calendar.monthrange(year, month)[1]
begin_date = date(year, month, 1).strftime('%Y-%m-%d')
end_date = date(year, month, last_day_of_month).strftime('%Y-%m-%d')
return begin_date, end_date
# -----------------------------------------
@tienhieuD
tienhieuD / blog_slide.html
Created August 9, 2018 04:27
Slide for Product & Blog homepage (contact me & send $1 for css)
<div class="em_blog_slide">
<div class="container">
<div class="row">
<div class="col-md-6">
<h2>Ưu đãi - Khuyến mãi</h2>
</div>
<div class="col-md-6 align_right align_left_sm">
<a href="#" class="view_more">Xem tất cả
<i class="fa fa-chevron-right" aria-hidden="true"></i>
</a>
nstr = [1, 2, 3, 4, 5, 6, 4, 3, 2, 3]
lst = [nstr[i:i + 3] for i in range(0, len(nstr), 3)]
print(lst)
# [[1, 2, 3], [4, 5, 6], [4, 3, 2], [3]]
import random
chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
def random_string(n):
return ''.join(random.SystemRandom().choice(chars) for _ in range(n))
i = 0
while(i < 10000000):
print(random_string(64))
//
#include<iostream>
#include<conio.h>
using namespace std;
class Sophuc
{
private:
float thuc, ao;
public:
def get_selection_name(env, model, field, value):
return dict(env[model].fields_get(field, 'selection').get(field, {}).get('selection',{})).get(value)
# usage
get_selection_name(request.env, 'sale.order', 'general_status', 'picking') # 'Đang lấy hàng'
get_selection_name(self.env, 'sale.order', 'general_status', 'picking') # 'Đang lấy hàng'
{
"name": "Python: Odoo",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${config:python.pythonPath}",
"program": "${workspaceRoot}/odoo-bin",
"args": [
"--config=../odoo.conf",
],