Skip to content

Instantly share code, notes, and snippets.

View pqviet07's full-sized avatar
🎯
Focusing

Phung Quoc Viet pqviet07

🎯
Focusing
View GitHub Profile
@pqviet07
pqviet07 / auto_mkdir.sh
Last active April 8, 2023 14:14
Bash shell for productivity
#!/bin/bash
#author: Phung Quoc Viet
#description: read all line from filname then create directorys with format: line/no.line
filename="filename.txt"
n=1
while read line; do
# reading each line
mkdir "$n. $line"
touch "./$n. $line/$line.cpp"
echo -n "File No.$n: $line"
@pqviet07
pqviet07 / tasks.json
Last active April 8, 2023 14:18
Task.json for compile c++ with Boost Library for vscode
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: g++.exe build active file with boost lib",
"command": "g++",
"args": [
"-g",
"${file}",
@pqviet07
pqviet07 / tasks.json
Last active April 8, 2023 14:17
Compile cpp file with boost and opencv library for vscode
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: g++.exe build active file with boost and opencv lib",
"command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-release-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++",
"args": [
"-g",
"${file}",
@pqviet07
pqviet07 / Build_Boost.md
Last active July 20, 2021 07:22
Cài đặt thư viện Boost

Cài thư viện Boost

  1. Vào thư mục vừa tải về, chạy file bootstrap.bat

    Hoặc gõ một trong các lệnh sau:

    bootstrap vc142 (if you are using Visual Studio 2019)
    bootstrap vc141 (if you are using Visual Studio 2017)

bootstrap vc140 (if you are using Visual Studio 2015)

@pqviet07
pqviet07 / Semaphore.cpp
Created October 14, 2021 08:35
Semaphore C++ 11
#include <mutex>
#include <condition_variable>
class Semaphore {
private:
std::mutex mtx;
std::condition_variable cv;
int count;
public:
#include <condition_variable> // std::condition_variale
#include <cstdlib>
#include <iostream>
#include <mutex>
#include <thread>
using namespace std;
std::mutex g_mutex;
std::condition_variable g_cv;
@pqviet07
pqviet07 / list-of-curl-options.txt
Created March 22, 2023 08:13 — forked from eneko/list-of-curl-options.txt
List of `curl` options
$ curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
@pqviet07
pqviet07 / NetworkInterception.cs
Last active June 3, 2023 05:10 — forked from jimevans/NetworkInterception.cs
Selenium C# network traffic logging example
public async Task LogNetworkRequests(IWebDriver driver)
{
INetwork interceptor = driver.Manage().Network;
interceptor.NetworkRequestSent += OnNetworkRequestSent;
interceptor.NetworkResponseReceived += OnNetworkResponseReceived;
await interceptor.StartMonitoring();
driver.Url = "http://the-internet.herokuapp.com/redirect";
await interceptor.StopMonitoring();
}
@pqviet07
pqviet07 / Dotnet_Build_Run_Release.sh
Last active June 2, 2023 15:37
Kill process then build and run dotnet core app
#!/bin/bash
#Kill process then re-build and run
pid=`ps aux | grep LuongThangScraper | grep -v grep | awk {'print $2'}`
if [ -z "$pid" ]
then
echo "LuongThangScraper not found!"
else
echo "LuongThangScraper running on PID = " $pid
kill -9 "$pid"
@pqviet07
pqviet07 / RWLock_std11.cpp
Last active April 12, 2023 07:26
RWLock in c++11 và c++17
#include <iostream>
#include <mutex>
#include <condition_variable>
#include <thread>
#include <vector>
class ReadWriteLock {
public:
void read(std::function<void()> reader) {
std::unique_lock<std::mutex> lock(mutex_);