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 / 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
@vietdien2005
vietdien2005 / config.sh
Created October 7, 2017 10:07
Fix force gdm login screen to the primary monitor
sudo cp ~/.config/monitors.xml /var/lib/gdm3/.config/
@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 / encryptor.md
Created April 9, 2017 09:54
encrypt decrypt id number
function encryptor($action, $string) {
    $output = false;

    $encrypt_method = "AES-256-CBC";
    //pls set your unique hashing key
    $secret_key = 'dj7oiop1mkdp251EnCrIt4QKq4988w6a';
    $secret_iv = 'oeuGJW0cBI4ye998Z7435sj9EkGnDD34';

 // hash
@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 / 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 / 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 / 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 / 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