Skip to content

Instantly share code, notes, and snippets.

View vietdien2005's full-sized avatar
🦉
there's something dark inside

Dam Viet vietdien2005

🦉
there's something dark inside
View GitHub Profile
@vietdien2005
vietdien2005 / perf_disk.md
Last active May 29, 2020 07:07
Check Performance Disk

Commands Check Performance Disk

Commands

  • Reading speed cache/buffer: hdparm
  • Check cache reading speed: hdparm
  • Sequential write speed: dd
  • Check iops when random read/write (block 4K): fio

Usage hdparm

@vietdien2005
vietdien2005 / readme.md
Last active April 8, 2020 09:50
Counting IP Addresses in a Log File
  • Command
grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+" /var/log/nginx/access.log
  • Unique IPs
grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+" /var/log/nginx/access.log | sort | uniq
@vietdien2005
vietdien2005 / crawl.php
Last active September 16, 2018 05:07
simple_html_dom.php
<?php
include 'simple_html_dom.php';
function crawlDetail($url)
{
$html = file_get_contents($url);
$html = str_get_html($html);
$info = [];
@vietdien2005
vietdien2005 / build.md
Created April 16, 2018 01:33
Build Curl http2

Firstly, install the dev tools you’re doing to need.

yum -y groupinstall "Development Tools" yum -y install libev libev-devel zlib zlib-devel openssl openssl-devel git Next, we’re going to store a few things in /var/tmp and install the new version of openssl into /opt/openssl

mkdir /var/tmp cd /var/tmp wget https://www.openssl.org/source/openssl-1.0.2-latest.tar.gz tar -zxf openssl-1.0.2-latest.tar.gz

@vietdien2005
vietdien2005 / install.sh
Last active March 22, 2018 10:12
install OpenCV & FFMPEG on Ubuntu 16.04
version="3.4.1"
echo "Installing OpenCV" $version
mkdir OpenCV
cd OpenCV
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -qq remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
@vietdien2005
vietdien2005 / reset.sh
Last active March 8, 2018 09:21
reset password mysql
# Stop MySQL
```bash
sudo /etc/init.d/mysql start
```
# Make MySQL service directory & give MySQL user permission to write to the service directory.
```bash
sudo mkdir /var/run/mysqld && sudo chown mysql: /var/run/mysqld
```
# Start MySQL manually, without permission checks or networking.
```bash
@vietdien2005
vietdien2005 / comand.sh
Created February 11, 2018 14:01
format usb on mac os x
diskutil partitionDisk /dev/disk2 1 MBRFormat "MS-DOS FAT32" EDISON 805.30M`
@vietdien2005
vietdien2005 / command.md
Last active June 1, 2018 10:28
encrypt variable inside config with travis command
  travis encrypt DOCKER_USER=<username> --add env.matrix
  travis encrypt DOCKER_PASS=<password> --add env.matrix
@vietdien2005
vietdien2005 / connect.sh
Last active June 21, 2022 00:03
Script Auto Reconnect OpenVPN
#!/bin/bash
read -p "Type name config file vpn: " name_file
function getStatus () {
ifconfig | grep $1 && return 1
return 0
}
while [[ 1 ]]; do
@vietdien2005
vietdien2005 / install.md
Last active November 6, 2023 15:59
Install Nagios + Nginx Centos 7
  • Install Dev Tools, PHP, Nginx
  sudo yum install nginx php php-fpm php-common gcc glibc glibc-common gd gd-devel make net-snmp unzip -y
  sudo yum groupinstall 'Development Tools' -y
  • Nginx – Nagios Configuration
  cd /etc/nginx/conf.d
  sudo vi nagios.conf