Skip to content

Instantly share code, notes, and snippets.

View qt91's full-sized avatar
🎯
Focusing

Thinh Nguyen qt91

🎯
Focusing
View GitHub Profile
// Code xóa tất cả các contact trong chatwork được thực thi
// F12 và paste vào tab console => thận trọng khi enter
function deleteChatwork(){
$('#_openContactWindow > span.globalHeaderNavItem__button').click();
$('#_contactWindowTabMyContact').click();
$('#_contactWindowBox li').each(function( index ) {
$.post( "https://www.chatwork.com/gateway/delete_contact.php?myid="+MYID+"&_v=1.80a&_av=5&ln=en&aid="+$(this).attr('data-aid') ,{pdata:JSON.stringify({"_t":ACCESS_TOKEN})}, function( data ) {
console.log(data);
});
@qt91
qt91 / Sử dụng Docker đơn giản hơn với Docker Compose.md
Last active December 16, 2022 06:58
Tại sao có Docker rồi mà còn đẻ ra Docker Compose

Tại sao có Docker rồi mà còn đẻ ra Docker Compose

Như bài viết Unserstand basic docker, việc sử dụng Docker bằng cách gõ lệnh, mới nhìn thì có vẻ chuyên nghiệp, nhưng dùng lâu thì sẽ rất mỏi tay và tốn nhiều thời gian. Thử tưởng tượng, nếu bạn cần setup một hệ thống có sử dụng 4 docker nginx, phpfpm, mysql, redis. Mỗi khi bạn muốn nó chạy các bạn sẽ phải gõ 4 dòng lệnh dài loàn ngoằn, chưa kể buồn buồn nó khởi động lại máy lại gõ lại.... có thể sẽ phải dành cả thanh xuân để đi gõ tới gõ lui các dòng lệnh nhàm chán. Bởi vậy, các con người chán chán cảnh gõ đi gõ lại đã tạo ra một công cụ mới có tên là Docker Compose.

enter image description here

Vậy Docker Compose là gì, liệu dùng nó có quên mất cách dùng Docker không?

Docker composer là một công cụ cho phép chúng ta có thể định nghĩa và khởi chạy nhiều Docker Container. Với Docker composer bạn có thể định nghĩa mộ

@qt91
qt91 / Understand basic docker.md
Last active October 20, 2019 07:36
Understand basic docker

Docker là gì?

Docker là một công cụ cho phép các nhà phát triển, sys-admin... có thể dễ dàng triển khai ứng dụng của mình lên chạy một môi trường phát triển Lợi ích chính mà Docker đem lại là cho phép người dùng có thể đóng gọi một ứng dụng với đầy đủ các thành phần liên quan Các Container của Docker sử dụng ít tài nguyên hơn các giải pháp sử dụng "Máy ảo" như "VMWare, VirtualBox..."

Docker Container là gì?

Trước khi nói về Container chúng ta sẽ chém gió đôi chút về VMs ( Virtual Machines ). Trước khi Docker ra đời, thì VMs vẫn thống trị trong việc triển khai các ứng dụng vì nhanh-gon-lẹ. Người dùng cần phải cài trên máy chính (Host) và nó sẽ tạo ra các máy ảo để chúng ta có thể cài đặt hệ điều hành cho hệ thống.

@qt91
qt91 / Message broker.md
Last active October 21, 2019 08:43
Message broker

Message broker là gì?

  • Hiểu nôm na nó là một chương trình cho phép nhận "Message" từ hệ thống gửi, sau đó gửi đến một hệ thống nhận.

Tại sao lại xuất hiện khái niệm Message broker?

  • Khi làm việc với các hệ thống lớn, phức tạp có sự kết hợp giữa nhiều công nghệ, việc giao tiếp giữa các thành phần trở nên khó khăn lúc này chúng ta sẽ nghỉ tới một hệ thống mới, có thể chuyển phát các giao tiếp giữa các hệ thống đảm bảo an toàn, đồng bộ và dễ dàng quản lý

Lợi ích mà Message broker đem lại?

  • Message broker đem lại một giải pháp kết nối các thành phần rời rạc không phần biệt sự khác về ngôn ngữ, hệ thống, phương thức...
@qt91
qt91 / LaravelUnittestMockService
Created July 15, 2019 08:39
Mock 2 function
$this->mock(SampleRepository::class, function (MockInterface $mock) {
$mock->shouldReceive('whereArray->save')->andReturnFalse();//Thang khon nang nay nam duoi, nhung phai duoc mock o tren
$mock->shouldReceive('whereArray')->andReturn(SampleModel::first());//Thang nay chay truoc, nhung lai goi sau
});
//Unit test la 1 chuoi su khon nan
@primaryobjects
primaryobjects / m3u8.md
Last active July 20, 2024 13:07
How to download m3u8 and ts video movie streams.

m3u8 Downloading

  1. Open Chrome Developer tools and click the Network tab.
  2. Navigate to the page with the video and get it to start playing.
  3. Filter the list of files to "m3u8".
  4. Find master.m3u8 or index.m3u8 and click on it.
  5. Save the file to disk and look inside it.
  6. If the file contains a single m3u8 master url, copy that one instead.
  7. Run the program m3u8x.
  8. Paste the same m3u8 url in both textboxes (URL and Quality URL) and click "Headers" and set the referral url and user-agent from the request as found in Chrome.
@me7
me7 / capture.py
Last active June 24, 2024 22:35
use adb to capture image and transfer to PC
# check device present: adb devices -> 5203d550fe3ea3ab
from time import clock, sleep
from subprocess import check_output, call
import re
#call this to capture image
def capture():
clock()
screen_on()
clear_camera_folder()
@n2o
n2o / docker-ip.md
Last active February 23, 2024 16:37
Show IP of your docker-container

Show IP of your Docker container

tested on Arch Linux x64 4.5.4-1-ARCH

Ever needed the IP of your running docker container? I found a script somewhere on Stackoverflow, packed it into a function and created an alias for it. This function is just a shorthand to get the IP by container ID or by the container's name:

Append this to your .bash_aliases or similar:

# ~/.bash_aliases
@msurguy
msurguy / List.md
Last active April 30, 2024 15:14
List of open source projects made with Laravel

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):

@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"