Skip to content

Instantly share code, notes, and snippets.

View keymastervn's full-sized avatar
🥐
salted egg yolk croissant

Dat Le-Tien keymastervn

🥐
salted egg yolk croissant
  • Employment Hero
  • HCMC, Vietnam
  • 08:07 (UTC +07:00)
View GitHub Profile
@keymastervn
keymastervn / HHEd.c
Last active May 21, 2016 12:29
Customized to puts FindProtoModel only for correcting unused triphones in fulllist
/* ----------------------------------------------------------- */
/* */
/* ___ */
/* |_| | |_/ SPEECH */
/* | | | | \ RECOGNITION */
/* ========= SOFTWARE */
/* */
/* */
/* ----------------------------------------------------------- */
/* developed at: */
require 'nokogiri'
require 'open-uri'
require 'rubygems'
require '../string_helper'
SOURCE = [
"http://vnexpress.net",
"http://tuoitre.vn",
"http://news.zing.vn",
"http://vietnamnet.vn",
### Keybase proof
I hereby claim:
* I am keymastervn on github.
* I am datlee (https://keybase.io/datlee) on keybase.
* I have a public key whose fingerprint is 9358 A9F2 74FB F6F5 D9C1 2625 2A06 1385 B43E B549
To claim this, I am signing this object:
@keymastervn
keymastervn / System Design.md
Created January 28, 2019 06:53 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@keymastervn
keymastervn / gist:fd21ac90792a01dfd64c4ba5dd387432
Last active February 17, 2019 10:33
Elastic Beanstalk extension - Nginx example with GZIP configuration
files:
'/etc/nginx/conf.d/01_proxy.conf':
mode: '000644'
owner: root
group: root
content: |
client_max_body_size 10M;
'/etc/nginx/default.d/01_locations.conf':
mode: '000644'
owner: root
@keymastervn
keymastervn / slim-redux.js
Created August 6, 2019 08:20 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@keymastervn
keymastervn / EB config to fix rails assets:precompile get EACCES
Last active August 16, 2019 07:58
ERROR in EACCES: permission denied, mkdir '/var/app/ondeck/node_modules/.cache'
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_yarn.sh" :
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
set -xe
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
# frozen_string_literal: true
require "spec_helper"
describe PgSearch::Multisearch do
with_table "pg_search_documents", &DOCUMENTS_SCHEMA
with_model :MultisearchableModel do
table do |t|
t.string :title
@keymastervn
keymastervn / gist:57b1e7da6a762e179e847962febb070c
Created June 23, 2020 15:09
Sanitizable lambda exec raw SQL eliminating params
// non param lambda as a method
def insert_sql
-> (controller, action, title, url, user_id) {
ActiveRecord::Base.connection.execute <<~SQL, [controller, action, title, url, user_id]
insert into dummy(controller, action, title, url, user_id, created_at, updated_at)
values(
$1,
$2,
$3,
$4,
@keymastervn
keymastervn / Gemfile
Created June 27, 2020 17:50 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers