Skip to content

Instantly share code, notes, and snippets.

View Phathdt's full-sized avatar
😆
there is always a reason to smile

Phathdt Phathdt

😆
there is always a reason to smile
  • Caliber Venture Builder
  • Ho Chi Minh city
View GitHub Profile
@Phathdt
Phathdt / autosub_dir
Last active May 2, 2017 16:06
Autosub all direction and subdirection
import os
import subprocess
import glob
import sys
from os.path import basename
def myfunction():
i = 0
dem = 0
directory_list = list()
for root, dirs, files in os.walk(str(sys.argv[1]), topdown=False):
@Phathdt
Phathdt / autosub_dir
Created June 13, 2017 04:43
autosub all file in this dir by Ruby
arr = Dir.entries('.').select { |elem| elem.include? ".mp4" }
arr.each { |elem|
puts "\nXu li file #{elem}"
system("autosub \"#{elem}\"")
}
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
@Phathdt
Phathdt / _readmore.html.slim
Created January 28, 2018 16:20
readmore function coffee and rails
- NUMBER_CHAR_HIDDEN = 300
- if content.length < NUMBER_CHAR_HIDDEN
p = content
- else
p
= content[0..NUMBER_CHAR_HIDDEN]
a.read-more-show.hide href="#" = "Read More"
span.read-more-content
= content[NUMBER_CHAR_HIDDEN + 1..-1]
a.read-more-hide.hide href="#" = "Read Less"
@Phathdt
Phathdt / api_controller.rb
Created February 4, 2018 14:17 — forked from jordifierro/api_controller.rb
Example of an Rails api ApiController when using ActiveSupport::Concern to encapsulate controllers common code
module Api::V1
class ApiController < ApplicationController
include Concerns::Authenticator
include Concerns::ErrorHandler
include Concerns::VersionExpirationHandler
include Concerns::Internationalizator
end
end
@Phathdt
Phathdt / cloudSettings
Last active March 31, 2021 07:41
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-03-31T07:41:01.483Z","extensionVersion":"v3.4.3"}

Zingo Requirements

User

  • user có thể đăng kí ( tên, email, sdt, giới tính, ngày sinh)
  • user có thể đăng nhập
  • user có thể quên mật khẩu

Friend

Using Elixir releases and multi-stage Docker files to simplify Phoenix deployment

This repo is my experiment in deploying a basic Phoenix app using the release feature from elixir 1.9 (https://elixir-lang.org/blog/2019/06/24/elixir-v1-9-0-released/) and docker, via a multi-stage Dockerfile (https://docs.docker.com/develop/develop-images/multistage-build/) leveraging bitwalker's docker images for Elixir and Phoenix.

Step 1: Install Elixir 1.9.1 (and Erlang)

The simplest way to manage Elixir versions is to use asdf.

@Phathdt
Phathdt / Dockerfile
Last active November 30, 2020 04:52
moira ES
FROM elasticsearch:7.7.1
COPY elasticsearch-analysis-vietnamese-7.7.1.zip /usr/share/elasticsearch/
RUN cd /usr/share/elasticsearch && \
bin/elasticsearch-plugin install --batch file:///usr/share/elasticsearch/elasticsearch-analysis-vietnamese-7.7.1.zip && \
bin/elasticsearch-plugin install --batch analysis-icu
@Phathdt
Phathdt / docker-compose.yaml
Created January 22, 2022 16:14
healthcheck
version: "3.9"
services:
db:
image: bitnami/postgresql:14.1.0
ports:
- '5433:5432'
environment:
POSTGRESQL_USERNAME: postgres
POSTGRESQL_PASSWORD: 123123123
POSTGRESQL_DATABASE: abc