Skip to content

Instantly share code, notes, and snippets.

View duykhoa's full-sized avatar

Kevin Tran duykhoa

View GitHub Profile
@duykhoa
duykhoa / Tearable-Cloth.markdown
Created July 29, 2014 09:15
A Pen by suffick.
@duykhoa
duykhoa / tmux_copymode_list.md
Last active May 18, 2020 13:10
tmux copy mode list

###How to use enable vi mode Here

Press prefix and '['. Ex: Ctrl B [

I use Ctrl A for prefix

###My recommend

After go to vi mode prefix [

@duykhoa
duykhoa / deploy.rb
Last active January 7, 2019 16:03
Mina deploy with Puma task, support `start, stop, restart` feature, use `pumactl`. Thanks this tutorial for saving my life: http://ruby-journal.com/how-to-setup-rails-app-with-puma-and-nginx/
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm' # for rvm support. (http://rvm.io)
set :domain, 'deploy@host'
set :repository, 'git...
set :branch, 'master'
set :shared_paths, ['config/database.yml', 'config/application.yml', 'log', 'tmp/sockets', 'tmp/pids']
@duykhoa
duykhoa / a.rb
Created January 18, 2018 09:24
test
class ImportParticipant
def initialize(source:, :target)
@source = source
@target = target
end
attr_reader :source, :target
def call
data = @source.read_and_parse
@duykhoa
duykhoa / install-comodo-ssl-cert-for-nginx.rst
Created February 18, 2017 05:39 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@duykhoa
duykhoa / pianokata
Last active October 12, 2017 10:16
Piano kata
require 'minitest/autorun'
class PianoKeyTest < Minitest::Test
KEYS_COUNT = 88
BLACK_KEY_SEQ = [0, 2, 5, 7, 9]
BLACK_SEQ_START_POS = 5
BLACK = "black"
WHITE = "white"
@duykhoa
duykhoa / as.f
Created March 30, 2017 05:42
email collection
f
@duykhoa
duykhoa / coverage_patch.sh
Last active March 17, 2017 05:16
COVERAGE PATCH
if [ -n "$ZSH_VERSION" ]; then
echo 'zsh env'
echo 'export COVERAGE=true' >> ~/.zshrc
elif [ -n "$BASH_VERSION" ]; then
echo 'bash env'
echo 'export COVERAGE=true' >> ~/.bashrc
else
echo 'You need to run `COVERAGE=true rspec` each time'
fi
@duykhoa
duykhoa / rack_notes.md
Created August 29, 2016 06:59
rack notes

Rack is a common interface to interact with different ruby server

to understand the concept of http server, we just need to search for some ruby code that implement a tcp server without any library.

here is a potato for you

  server = TCPServer.new('localhost', 12345)
@duykhoa
duykhoa / blogapplicationserver.rb
Created August 27, 2016 14:23
Simple webrick server: a blog application and post repository
require 'webrick'
class BlogApplication < WEBrick::HTTPServlet::AbstractServlet
class PostRepository
Post = Struct.new(:title, :content)
def self.get
[
Post.new("post1", "content1"),
Post.new("post2", "content2")