Skip to content

Instantly share code, notes, and snippets.

View congdinh's full-sized avatar
🤠
Always learning

Neo congdinh

🤠
Always learning
View GitHub Profile
@congdinh
congdinh / rabbitmq.ts
Last active October 26, 2023 16:36
RabbitMQ provider module using amqplib
import amqp, { Channel, Connection, ConsumeMessage } from 'amqplib';
require('dotenv').config();
interface RabbitMQConfig {
host: string;
port: number;
user: string;
password: string;
queueDefault: string;
}
const x = document.querySelectorAll("body div#ak-main-content table tbody tr");
var list = [];
console.log(x.length);
let doc = "";
const groupBy = (xs, f) => xs.reduce((r, v, i, a, k = f(v)) => ((r[k] || (r[k] = [])).push(v), r), {});
x.forEach((element, i) => {
const type = element.querySelector('tr > td:nth-child(1)')?.textContent.trim();
const key = element.querySelector('tr > td:nth-child(2)')?.textContent.trim();
const summary = element.querySelector('tr > td:nth-child(3)')?.textContent.trim();
const x = document.querySelectorAll("body div.vymo-table table tbody tr");
var list = [];
console.log(x.length);
x.forEach((element, i) => {
const created = element.querySelector('tr > td:nth-child(2)')?.textContent.trim();
const apiType = element.querySelector('tr > td:nth-child(3)')?.textContent.trim();
const moduleType = element.querySelector('tr > td:nth-child(4)')?.textContent.trim();
const updateType = element.querySelector('tr > td:nth-child(5)')?.textContent.trim();
const statusCode = element.querySelector('tr > td:nth-child(6)')?.textContent.trim();
const status = element.querySelector('tr > td:nth-child(7)')?.textContent.trim();
@congdinh
congdinh / show-card-name-trello.js
Last active August 31, 2020 09:18
Show card name in trello
var elements = $(".list-wrapper:nth-child(8) .js-list-content .js-sortable a");
elements.each( function () {
var a = $(this).find('.js-card-name').text()
console.log(a);
document.write('----------', a,'</br>');
});
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/neo/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@congdinh
congdinh / cmd.linux
Last active February 12, 2020 16:31
1. Quản lý hệ thống¶
rpm: kiểm tra gói đã cài đặt, hoặc cài đặt một gói, hoặc sử dụng để gỡ bỏ một gói.
ps: kiểm tra hệ thống tiến trình đang chạy.
kill: stop proccess khi bị treo. Chỉ có super-user mới có thể dừng tất cả các tiến trình còn user khác chỉ có thể dừng proccess mà user đó tạo ra.
top: hiển thị sự hoạt động của các tiến trình, đặc biệt là thông tin về tài nguyên hệ thống và việc sử dụng các tài nguyên đó của từng tiến trình.
pstree: hiển thị tất cả các tiến trình dưới dạng cây.
{
"Profiles": [
{
"Ansi 5 Color" : {
"Green Component" : 0.10802463442087173,
"Blue Component" : 0.43516635894775391,
"Red Component" : 0.77738940715789795
},
"Working Directory" : "\/Users\/neo",
"Prompt Before Closing 2" : false,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.25098040699958801</real>
@congdinh
congdinh / nginx-tuning.md
Created February 1, 2020 17:42 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.