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 / 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 / install.md
Created December 31, 2017 01:34
install CPU Mining
  sudo apt-get install git libcurl4-openssl-dev build-essential libjansson-dev autotools-dev automake
  git clone https://github.com/hyc/cpuminer-multi
  cd cpuminer-multi
  ./autogen.sh
  CFLAGS="-march=native" ./configure
  sudo make
  sudo make install 
  sudo ./minerd -a cryptonight -o stratum+tcp://pool.minexmr.com:4444 -u <WALLET_ADDRESS_HERE> -p x -t 3
@vietdien2005
vietdien2005 / install.md
Last active December 30, 2017 06:56
install bfgminer with cpu mining on Ubuntu 16.04

Install

  sudo apt-get install bfgminer
  • Unfortunately the version was not up to date, and was not compiled for mining scrypt-based coins like Litecoin. Here is how I built BFGMiner with this support.

  • Install the dependencies:

  sudo apt-get install build-essential autoconf libtool libjansson-dev libcurl4-gnutls-dev libncurses5-dev libudev-dev libusb-1.0-0-dev yasm uthash-dev
@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 / stream.sh
Last active October 7, 2017 10:07
streaming with ffmpeg
VBR="2500k"
FPS="30"
QUAL="veryfast"
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2"
SOURCE="http://125.212.211.162:8080/live/super-sunday.m3u8"
SOURCEFB="https://video-hkg3-1.xx.fbcdn.net/hvideo-atn2/v/dash-md/267360413666075-854021.m4a"
KEY="agyz-6wy0-k429-8gqu"
#ffmpeg \
@vietdien2005
vietdien2005 / Theming-Slack-OSX.md
Created May 25, 2017 08:36 — forked from mswieboda/Theming-Slack-OSX.md
Theming Slack for OSX 🕶️

Theming Slack for OSX

So, you love Slack, but you hate applications with large white backgrounds? Why not use Dark Mode! 🕶️

Unfortunately, Slack does not have a Dark Mode, although it's on their list of possibilities.

But, don't fret - there is a solution! Because the slack native desktop apps are just wrappers around a web app, we can inject our own CSS to customize the application to our liking.

(I take no credit for this exploit, graciously found via @DrewML https://gist.github.com/DrewML/0acd2e389492e7d9d6be63386d75dd99 and suggestions by @bradens, @jouni, @gkostov and others).

@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
  • Create your public key and private key
// Config RSA
$config = [
    "digest_alg"       => "sha512",
    "private_key_bits" => 2048,
    "private_key_type" => OPENSSL_KEYTYPE_RSA,
];

// Create the private and public key