Skip to content

Instantly share code, notes, and snippets.

@vuongpd95
vuongpd95 / devise.vi.yml
Last active September 20, 2021 16:02 — forked from anhkind/devise.vi.yml
vi:
devise:
confirmations:
confirmed: Xác nhận tài khoản thành công!
send_instructions: Bạn sẽ nhận được email hướng dẫn xác nhận tài khoản trong vài phút nữa.
send_paranoid_instructions: Nếu email của bạn có trong hệ thống, bạn sẽ nhận được email hướng dẫn xác nhận tài khoản trong một vài phút nữa.
failure:
already_authenticated: Bạn đã đăng nhập.
inactive: Tài khoản của bạn chưa được kích hoạt.
invalid: "%{authentication_keys} hoặc mật khẩu không hợp lệ."
@vuongpd95
vuongpd95 / speedup-docker-image-building-using-multi-stage-build.md
Last active September 9, 2021 13:59
Speedup Docker Image building using multi stage build

Dockerfile

# Build rarely changed system libraries
FROM phusion/passenger-ruby27:1.0.16 AS builder

ENV RAILS_ENV=${RAILS_ENV:-production}
ENV NODE_ENV=${RAILS_ENV:-production}
ENV RACK_ENV=${RAILS_ENV:-production}
ENV PASSENGER_APP_ENV=${RAILS_ENV:-production}
@vuongpd95
vuongpd95 / vim-essentials.md
Last active November 26, 2021 02:42
My Vim essentials

My Vim Essentials

Those are the commands which I frequently use & feel it effective & easy.

Working with .vimrc, Vundle

  • :source % to reload vimrc
  • :PluginInstall to install plugin using Vundle

Navigations

@vuongpd95
vuongpd95 / .vimrc
Last active November 26, 2021 02:44
My .vrimrc
" Install Vim
" sudo apt-get install vim
" Install Vundle
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" $ vim
" $ :PluginInstall
set shell=/bin/bash
set nocompatible
set encoding=utf-8
set fileencodings=urf-8
@vuongpd95
vuongpd95 / gcp-command-cheatsheet.md
Last active October 31, 2020 06:33
GCP command cheatsheet

GCP Data flow

For VM instance, it's essential that:

  • Before a VM instance can be created, compute API should be enabled gcloud services enable compute.googleapis.com
  • zone and machine-type are required in order to create a VM instance
  • Metadata can be passed to the instance by using --metadata={{ attribute name }}={{ attribute value }} which then can be retrieved by curl -H "Metadata-Flavor: Google" http://http://metadata.google.internal/computeMetadata/v1/instance/attributes/{{ attribute name }} while inside the instance.
  • To set startup script of a VM instance from a file --metadata-from-file startup-script={{ Relative path to the startup script }}. But, do remember, startup-script is just an attribute so we can also do --metadata startup-script='...'. startup-script can be read by curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/startup-script
  • For the VM instance to be able to use any GCP services, it needs to have the
@vuongpd95
vuongpd95 / customize-rails-trix-toolbar.md
Last active June 18, 2023 14:42
How to customize Rails trix editor toolbar
var Trix = require("trix")
require("@rails/actiontext")

Trix.config.blockAttributes.heading2 = {
  tagName: 'h2',
  terminal: true,
  breakOnReturn: true,
  group: false
}
@vuongpd95
vuongpd95 / lib-mina-local_assets-tasks.rb
Last active February 15, 2021 01:34
Local Precompile Assets for low spec VM
# In deploy.rb
# require_relative '../lib/mina/local_assets/tasks'
# ...
# task :deploy do
# # uncomment this line to make sure you pushed your local branch to the remote origin
# # invoke :'git:ensure_pushed'
# invoke :'local_assets:clobber'
# invoke :'local_assets:precompile'
# invoke :'local_assets:sync_to_remote_tmp'
@vuongpd95
vuongpd95 / rails-docker-compose.md
Created September 27, 2020 13:53
docker-compose for Rails application on Local
# docker/webapp/Dockerfile
FROM ruby:2.6.6

SHELL ["/bin/bash", "-c"]
RUN apt-get update -qq && apt-get install -y postgresql-client memcached tzdata nano
# Install node 12, yarn
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
@vuongpd95
vuongpd95 / make-your-own-ruby-gem.md
Last active September 7, 2020 19:23
Make your own Ruby Gem
Name: Flash
Serial: eNrzzU/OLi0odswsqnHLSSzOqDGoca7JKCkpsNLXLy8v1ytJTczVLUotKNFLzs8FAJHYETc=
if anyone wants to thank ETH: 0x527c2aB55b744D6167dc981576318af96ed26676
Thank you!