Skip to content

Instantly share code, notes, and snippets.

View redlotus's full-sized avatar
💭
YOLO!!! 🚀

redlotus redlotus

💭
YOLO!!! 🚀
View GitHub Profile
@redlotus
redlotus / utf8.txt
Created December 29, 2017 09:34
utf8-checker
UTF-8 encoded sample plain-text file
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Markus Kuhn [ˈmaʳkʊs kuːn] <http://www.cl.cam.ac.uk/~mgk25/> — 2002-07-25 CC BY
The ASCII compatible UTF-8 encoding used in this plain-text file
is defined in Unicode, ISO 10646-1, and RFC 2279.
@redlotus
redlotus / pentaho-installer.sh
Created November 18, 2017 14:10
pentaho installer
#!/usr/bin/sh
# prepare tomcat
apt-get update &&
apt-get install default-jdk &&
groupadd tomcat &&
sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat &&
cd /tmp &&
curl -O http://apache.mirrors.ionfish.org/tomcat/tomcat-8/v8.5.23/bin/apache-tomcat-8.5.23.tar.gz &&
mkdir /opt/tomcat &&
@redlotus
redlotus / cors.nginxconf
Created November 7, 2017 08:13 — forked from pauloricardomg/cors.nginxconf
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {
@redlotus
redlotus / odoo_deploy.md
Created October 31, 2017 17:13
odoo_deploy_process

install depend

sudo apt-get update && apt-get upgrade
apt-get install git python-pip postgresql postgresql-server-dev-9.5 python-all-dev python-dev python-setuptools libxml2-dev libxslt1-dev libevent-dev libsasl2-dev libldap2-dev pkg-config libtiff5-dev libjpeg8-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev liblcms2-utils libwebp-dev tcl-dev tk-dev python-tk libyaml-dev fontconfig virtualenv
@redlotus
redlotus / docker-compose-daemon.sh
Created October 13, 2017 05:26 — forked from domachine/docker-compose-daemon.sh
run docker-compose in daemon mode and attach to web container
docker-compose up -d
docker attach myapp_web_1
@redlotus
redlotus / odoo.dev.conf
Created October 3, 2017 09:22
odoo.dev.conf
[options]
addons_path = /home/whodoo/GHN-WFS/odoo/odoo/addons,/home/whodoo/GHN-WFS/ghn_addons
admin_passwd = admin
auto_reload = False
csv_internal_sep = ,
data_dir = /home/whodoo/.local/share/Odoo
db_host = 127.0.0.1
db_maxconn = 64
db_name = demo
db_password = False
@redlotus
redlotus / docstrings.py
Created October 2, 2017 04:34
Google Style Python Docstrings
# -*- coding: utf-8 -*-
"""Example Google style docstrings.
This module demonstrates documentation as specified by the `Google Python
Style Guide`_. Docstrings may extend over multiple lines. Sections are created
with a section header and a colon followed by a block of indented text.
Example:
Examples can be given using either the ``Example`` or ``Examples``
sections. Sections support any reStructuredText formatting, including
@redlotus
redlotus / API.md
Created August 2, 2017 08:24 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@redlotus
redlotus / git_workflow.md
Last active October 16, 2017 03:47
git workflow

Code Versioning

Tính năng mới

  1. Tạo nhánh mới từ branch development. Eg: git branch todo_task
  2. Commit và push trên branch của mình
  3. Sau khi đã test xong trên nhánh tính năng, checkout qua branch development, merge code, fix conflict nếu có và push code để test trên server. Eg: git merge todo_task
  4. [IMPORTANT] Code được approved thì người có trách nhiệm merge code từ nhánh tính năng vào nhánh release để chạy trên production. Eg: git merge todo_task
  5. [IMPORTANT] Code được approved thì người có trách nhiệm merge code từ nhánh tính năng vào nhánh master (code master là code ổn định nhất). Eg: git merge todo_task
  6. [IMPORTANT] Những version ổn định nhất thì đặt tag cho nó để có thể rollback dễ hơn khi cần (branch release và master). Eg: git tag -a rel-v20170727-001 -m 'msg here'

[NOTE] Luôn luôn pull code trước khi làm việc gì khác với git để tránh confict.

@redlotus
redlotus / download-file.ts
Created December 16, 2016 08:44
downloadFileUsingFileTransfer.ts
downloadFile(id: string, name: string) {
this.platform.ready().then(() => {
const fileTransfer = new Transfer();
let url = constants.API_ENDPOINT + '/web/binary/saveas?model=ir.attachment&field=datas&filename_field=name&id=' + id;
console.log(url);
// let downloadBrowser = new InAppBrowser(url, '_system');
fileTransfer.download(url, cordova.file.externaldataDirectory + name, true)
.then((entry) => {
console.log('download complete: ' + entry.toURL());
}, (error) => {