Skip to content

Instantly share code, notes, and snippets.

View goyuninfo's full-sized avatar

goyun.info goyuninfo

View GitHub Profile
@goyuninfo
goyuninfo / gist:a02ccdc225d4c6ab09c4ccd2cfed1647
Last active January 30, 2021 23:45
IT Swiss Tools Awesome List
git
vim
jenkins
Blogger
Wordpress
Distribution Install Systemd Start on Boot Alt Start on Boot
CentOS 8+ dnf install cronie systemctl enable crond chkconfig crond on
Fedora 22+ dnf install cronie cronie-anacron systemctl enable crond chkconfig crond on
Debian sudo apt install cron systemctl enable crond update-rc.d cron defaults
SELECT
r.trx_wait_started AS wait_started,
TIMEDIFF(NOW(), r.trx_wait_started) AS wait_age,
rl.lock_table AS locked_table,
rl.lock_index AS locked_index,
rl.lock_type AS locked_type,
r.trx_id AS waiting_trx_id,
r.trx_mysql_thread_id AS waiting_pid,
r.trx_query AS waiting_query,
rl.lock_id AS waiting_lock_id,
# Python example code of heap data structure
# importing "heapq" to implement heap queue
import heapq
# initializing list
li = [5, 6, 9, 2, 8]
# using heapify to convert list into heap
heapq.heapify(li)
#!/bin/bash
_file="$1"
[ $# -eq 0 ] && { echo "Usage: $0 filename"; exit 1; }
[ ! -f "$_file" ] && { echo "Error: $0 file not found."; exit 2; }
if [ -s "$_file" ]
then
echo "$_file has some data."
# do something as file has data
else
#!/bin/bash
# get file name only without path
file_name=$(basename $BASH_SOURCE)
# get extension
file_extension="${file_name##*.}"
# get file name without extension
file="${file_name%.*}"
# print them to verify
echo "Full input file : $BASH_SOURCE"
echo "Filename only : $file_name"
{
"filter": {
"id": "main",
"class": [
{
"name": "table_access_data",
"event": {
"name": [
"insert",
"update",
@goyuninfo
goyuninfo / gist:1ac441f40e0cea3fdc02a6774223ef62
Created December 15, 2020 19:23
MySQL Audit Filtering Example: Only Log Successfully Executed INSERT Statements For some Specific Database/Tables Combinations
{
"filter":
{
"id": "main",
"class":
{
"name": "table_access",
"event":
{
"name": [ "insert" ],
SELECT t.date, count(*)
FROM table1 t
GROUP BY hour( t.date ) , day( t.date )
apt update
apt install software-properties-common
add-apt-repository ppa:deadsnakes/ppa
apt update
apt install python3.9 python3.9-venv python3.9-dev