Skip to content

Instantly share code, notes, and snippets.

View andreconghau's full-sized avatar

andre andreconghau

  • Software Engineer
  • việt nam
View GitHub Profile
from imageai.Detection import ObjectDetection
import os
execution_path = os.getcwd()
print(execution_path)
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path, "resnet50_coco_best_v2.1.0.h5")) # Download the model via this link https://github.com/OlafenwaMoses/ImageAI/releases/tag/1.0
detector.loadModel()
input_image=os.path.join(execution_path, "02.png")
<?php
/**
* https://www.youtube.com/watch?v=IoLXT1UleX4&index=7&list=PLGJDCzBP5j3xGaW0AGlaVHK2TMEr2XkP9
* https://github.com/ezimuel/PHP-design-patterns
* http://fsd14.com/post/91-design-pattern-decorator-design
*
*
* Chúng ta có thể sử dụng decorator pattern khi ta muốn đưa ra một số trách nhiệm bổ sung vào class cơ sở. Nghĩa là một class có thể
* được add thêm một chức năng của class khác mà không thay đổi cấu trúc của class.
@andreconghau
andreconghau / ig_convert_shortcod_media_id.js
Created June 1, 2022 10:01
Instagram How to convert short code to media id two ways
const bigint = require('big-integer')
const lower = 'abcdefghijklmnopqrstuvwxyz';
const upper = lower.toUpperCase();
const numbers = '0123456789'
const ig_alphabet = upper + lower + numbers + '-_'
const bigint_alphabet = numbers + lower
function toShortcode(longid) {
const o = bigint(longid).toString(64)
@andreconghau
andreconghau / nvm.md
Created February 16, 2022 02:00
manage node version

https://github.com/nvm-sh/nvm

Edit profiel

vim .bash_profile

# add new
 export NVM_DIR="$HOME/.nvm"
  [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
 [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] &amp;&amp; . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
@andreconghau
andreconghau / phpexcel_cell_format_bg.php
Created September 13, 2021 07:37
phpexcel format cell fill background color
$page = 0;
$this->PhpExcel->createSheet($page);
$this->PhpExcel->setActiveSheetIndex($page);
$sheet = $this->PhpExcel->getActiveSheet();
$sheet->getStyle("A1:A7")->applyFromArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('rgb' => 'FFE699')
version: '2.2'
services:
ignest1:
image: docker.elastic.co/elasticsearch/elasticsearch:6.6.2
container_name: ignest1
environment:
- cluster.name=es-cluster
- node.name=ignest1
- node.master=false
- node.data=false
@andreconghau
andreconghau / BookItem.swift
Created October 20, 2020 09:08
Swipe to action TableViewCell ios 13. You can swipe to both right and left, and UIAlert if delete some one.
// MODEL Object Realm
import Foundation
import RealmSwift
@objcMembers class BookItem: Object {
enum Property: String {
case id, name, isCompleted
}
dynamic var id = UUID().uuidString
@andreconghau
andreconghau / not_selected_when_hidekeyboard.swift
Created October 15, 2020 01:33
can not called seletedAt after apply hideKeyboard when touch outside
extension UIViewController {
public func hideKeyboarOnTap() {
let tap = UITapGestureRecognizer(target: self, action: #selector(hideKeyboardAction))
tap.cancelsTouchesInView = false
self.view.addGestureRecognizer(tap)
}
@objc private func hideKeyboardAction() {
self.view.endEditing(true)
@andreconghau
andreconghau / getdata_swiftyjson.swift
Last active October 14, 2020 08:39
Swift 5 Using SwiftJson to catch data Json without Decodable
// https://github.com/SwiftyJSON/SwiftyJSON
import Alamofire
import SwiftyJSON
classs ExampleSwiftyJson {
func jsonSwiftyJson() {
let user = "user"
let password = "password"
let credential = URLCredential(user: user, password: password, persistence: .forSession)
@andreconghau
andreconghau / loadimage_kingfisher.swift
Last active October 14, 2020 06:36
Kingfisher download image and caching in memory. can be show progress bar downloading
// https://github.com/onevcat/Kingfisher/wiki/Installation-Guide
// https://github.com/onevcat/Kingfisher/wiki/Cheat-Sheet
import UIKit
import Kingfisher
class example {
func viewDidLoad {
// Apply KingFisher
let resource = ImageResource(downloadURL: imgUrl!)