Skip to content

Instantly share code, notes, and snippets.

@tungbt94
tungbt94 / vim-heroku.sh
Created July 12, 2022 07:49 — forked from dvdbng/vim-heroku.sh
Run vim in heroku updated 2017
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
curl 'https://s3.amazonaws.com/bengoa/vim-static.tar.gz' | tar -xz
export VIMRUNTIME="$HOME/vim/runtime"
export PATH="$HOME/vim:$PATH"
cd -

Keybase proof

I hereby claim:

  • I am tungbt94 on github.
  • I am tungbt94 (https://keybase.io/tungbt94) on keybase.
  • I have a public key ASCMutEYS2GRvOCfy12-LUyJ2t98LQUeuISkFFSZZjyfhQo

To claim this, I am signing this object:

Prometheus

  • Có thể dùng docker, có image prometheus + grafana sẵn.
  • Đã bao gồm AlertManager.
  • Chỉ support chính thức client cho 1 số ngôn ngữ: Go, Java, Python, Ruby. Có nhiều ngôn ngữ khác nhưng “Unofficial”
  • Query khá dễ hiểu với người từng viết python, ruby
  • Support khá nhiều 3rd party export metric
  • Chiếm khá ít RAM + CPU. Thử trên t2.medium không thấy vấn đề gì sau 3 ngày
  • Được sử dụng bởi nhiều bên: Digital Ocean, Hostinger
@tungbt94
tungbt94 / Vue listen component event.html
Created February 18, 2019 03:25
Vue listen event from vue component
<nuxt-link
:to="..."
@mouseover.native="onMouseOver"
@mouseleave.native="onMouseOut">
...
</nuxt-link>
<!-- Use .navtive -->
@tungbt94
tungbt94 / Vue LazyLoad image with lozad
Last active January 10, 2019 06:17
Simple lazy loading <img> vue component using lozad
<template>
<img :data-src="lazySrc" :data-srcset="lazySrcset" :style="style"/>
</template>
<script>
import lozad from "lozad";
export default {
name: "LazyImage",
props: {
Each YouTube video has 4 generated images. They are predictably formatted as follows:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
@tungbt94
tungbt94 / install-watchman.sh
Last active July 11, 2018 10:54 — forked from ivan-loh/install-watchman.sh
Watchman ( 4.9.0 ) installation for Ubuntu 16.04
# checkout, compile & install
git clone [email protected]:facebook/watchman.git
cd watchman/
git checkout v4.9.0
sudo apt-get install -y autoconf automake build-essential python-dev libssl-dev libtool
./autogen.sh
./configure
make
sudo make install
@tungbt94
tungbt94 / vue-hide-keyboard-mobile.vue
Created July 11, 2018 03:36
Hide mobile keyboard on enter
<template>
<div class="hello">
<h1>{{ query }}</h1>
<input
ref="input"
v-model="query"
@focus="showMobileKeyboard"
@keyup.enter="hideMobileKeyboard"/>
</div>
</template>
@tungbt94
tungbt94 / read_image.go
Created May 22, 2018 10:54
Read png image to 2D array written by golang
package main
import (
"fmt"
"image"
"image/png"
"os"
)
func main() {
@tungbt94
tungbt94 / convert-img-in-folder.go
Created May 5, 2018 12:05
Convert image in folder to resize them
// Note: You have to install imagemagick before
package main
import (
"bufio"
"fmt"
"log"
"os"
"os/exec"
"path/filepath"