Skip to content

Instantly share code, notes, and snippets.

View alivx's full-sized avatar
😇
our business is life itself

Ali alivx

😇
our business is life itself
View GitHub Profile
@alivx
alivx / ansible-summary.md
Created June 24, 2020 08:02 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@alivx
alivx / csplit.sh
Created June 15, 2020 05:27
Split one log file into multiple files based on string or prefix
Exmaple log file:
```Log
New Request 1
get user-id (Ref_8a28)
update user history (Ref_7a27)
send notification (Ref_6a26)
user info updated (Ref_5a25)
New Request 2 (Ref_4a24)
@alivx
alivx / ansible.cfg
Created May 23, 2020 15:15
Default Ansible config file
# Example config file for ansible -- https://ansible.com/
# =======================================================
# Nearly all parameters can be overridden in ansible-playbook
# or with command line flags. Ansible will read ANSIBLE_CONFIG,
# ansible.cfg in the current working directory, .ansible.cfg in
# the home directory, or /etc/ansible/ansible.cfg, whichever it
# finds first
# For a full list of available options, run ansible-config list or see the
@alivx
alivx / excelPandasImport.py
Created May 20, 2020 10:50
Import Excel to pandas
import pandas as pd
fileName = 'excelFile.xlsx'
sheet1 = pd.read_excel(fileName, sheet_name = 'sheet1')
sheet2 = pd.read_excel(fileName, sheet_name = 'sheet2')
sheet3 = pd.read_excel(fileName, sheet_name = 'sheet3')
@alivx
alivx / sshvpn.sh
Created April 13, 2020 19:52
SSH as VPN
sshuttle -v -r username@hostip -x hostip 0/0
without output:
sshuttle -v -r username@hostip -x hostip 0/0 >/dev/null 2>&1
@alivx
alivx / getTableSize.sql
Created April 5, 2020 13:57
Get mysql table size in MB
SELECT table_name AS "Table",
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"
FROM information_schema.TABLES
WHERE table_schema = "alidb"
ORDER BY (data_length + index_length) DESC;
@alivx
alivx / mysql-docker.sh
Created March 30, 2020 11:42 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE