- trace an executable:
strace ls
- trace specific system call:
strace -e open ls
- trace multiple system call:
strace -e trace=open,read,write ls
- save trace output:
strace -o ls.txt ls
- trace a running linux process:
sudo strace -p pid
- print timestamp:
strace -t ls
- gerate stat:
strace -c ls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mxfile host="app.diagrams.net" modified="2020-06-03T21:01:58.638Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36" etag="a1-ix2r6zzVVSPH3lcE_" version="12.9.3" type="device"><diagram id="h7GPxYbChwaNLsouTysn" name="Page-1">7V1pd9rG1/80nKYvyNEu8ZJ4SZ3EsWPcp+3/TY9AA6gGDZWEHfrpnxltSHMvi40WhMk5sY0kJLi/ufsyHfVi/vOzby+mt9Qhs44iOT876mVHUWSjp7Nf/MgqPqJpVnxg4rtOctH6wMD9jyQHpeTo0nVIULgwpHQWuoviwRH1PDIKC8ds36cvxcvGdFZ86sKeEHBgMLJn8OgfrhNO46OWYq6P/0bcyTR9MvvG8Zm5nV6cfJNgajv0JXdIveqoFz6lYfzX/OcFmXHipXSJ33e94Wz2wXzihfu84Z9H25ldvHxR/9a1fx/Gtvbb5KGra/Ftnu3ZMvnGX+xnu6MYM3bTT0Of/TXhf11QL1jOiQ/PbDkiHhhT9lEZJcJVQl7j3yVNT3SDCPw+u0CWFj/XJ9O7XA0pffpMPOLbIfUHxH92RyS9Nfve8d2LT2SHc59CKTxc8enScwgnj8xOv0zdkAwW9oiffWGrmR2bhvNZcnrszmYXdEb96L0qkR2dmOx4EPr0ieTO9AxTtY3sTLpqlOwT5CFLUHwmfkh+5g4lEH4mdE5Cf8UuSc7qSoJYwk+yoiXr62W9POV0zU1zS9NIjtkJR0yye68XDfsjWTf4Grob3F9fXy97N18WxuAfpSvfeNddtubBIjqM1mXQySySSe5BMqmmCsmk6FXRSdlNJTtYxEJs7P7kxPq0IL7Lnk742mKPYFKP3K8P5Wlmz9yJx/4eMZpF5zJ5I7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import re | |
logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s- %(message)s') | |
nginx_access_log_path = "/var/log/nginx/access.log" | |
def parse_with_split(): | |
response_code_count = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get install git python-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl | |
sudo pip install virtualenvwrapper | |
git clone https://github.com/yyuu/pyenv.git ~/.pyenv | |
git clone https://github.com/yyuu/pyenv-virtualenvwrapper.git ~/.pyenv/plugins/pyenv-virtualenvwrapper | |
git clone https://github.com/pyenv/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://realpython.com/python-map-function/#coding-with-functional-style-in-python | |
# with a for loop | |
numbers = [1, 2, 3, 4, 5] | |
squared = [] | |
for num in numbers: | |
squared.append(num ** 2) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -ti -v $(pwd):/tmp DOCKER_IMAGE /bin/bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import gzip | |
import os | |
import sys | |
import re | |
INPUT_DIR = "nginx-logs" | |
lineformat = re.compile(r"""(?P<ipaddress>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - - \[(?P<dateandtime>\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\] ((\"(GET|POST) )(?P<url>.+)(http\/1\.1")) (?P<statuscode>\d{3}) (?P<bytessent>\d+) (["](?P<refferer>(\-)|(.+))["]) (["](?P<useragent>.+)["])""", re.IGNORECASE) |
SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.
apt-get install sshpass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH=~/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/sbin:$PATH | |
export EDITOR=vim | |
export APPLICATION_ENV="development" | |
export CLICOLOR=1 | |
export LSCOLORS=dxfxcxdxbxegedabagacad | |
alias composer="php /usr/local/bin/composer.phar" | |
_complete_ssh_hosts () | |
{ |