Skip to content

Instantly share code, notes, and snippets.

View mrjk's full-sized avatar

mrjk

  • Montréal
View GitHub Profile
@mrjk
mrjk / bash_lib_app.sh
Last active December 31, 2023 02:26
Bash utils lib
# Logging and User interactions
# ==============
_log ()
{
local lvl=${1:-DEBUG}
shift 1 || true
local msg=${*}
if [[ "$msg" == '-' ]]; then
@mrjk
mrjk / oneliners.bash
Last active January 9, 2024 03:38
Bash oneliners
# Other
# =========
# See .bashrc config: https://gist.github.com/mrjk/fdb73dc33cbc1c23e21010efc451cbdd
# See: .vimrc config: https://gist.github.com/mrjk/1d146a701b201e77279ea4e7c5d075a5
# See: bash library utils: https://gist.github.com/mrjk/31a2fb90c445fe516b0ae41eea7297ea
# Shell/Bash
# =========
@mrjk
mrjk / disk-speed-test.sh
Last active December 21, 2023 20:28
Get disk infos and test speed with dd
#!/bin/bash
# Tooling: Debian
# apt install smartmontools sysstat hdparm
# Sata infos
# SATA revision 1.0 => 1.5 Gbit/s, 150 MB/s
# SATA revision 2.0 => 3 Gbit/s, 300 MB/s
# SATA revision 3.0 => 6 Gbit/s, 600 MB/s
# SATA revision 3.2 => 16 Gbit/s, 1969 MB/s
@mrjk
mrjk / openssl-speed-test.sh
Last active December 21, 2023 20:43
CPU Crypt speed Bench
#!/bin/bash
openssl speed
# See: https://openwrt.org/docs/guide-user/perf_and_log/benchmark.openssl
# https://openwrt.org/docs/techref/hardware/cryptographic.hardware.accelerators
cryptsetup benchmark
# See: https://possiblelossofprecision.net/?p=2255
@mrjk
mrjk / system-info-report.sh
Last active December 21, 2023 20:27
Linux server report
#!/bin/bash
main ()
{
local dest=${1:-REPORT}
mkdir -p $dest
@mrjk
mrjk / .bashrc
Last active September 7, 2022 04:31
minimal bashrc
# Base stuffs
alias la='ls -ah'
alias ll='ls -lh'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias ~='cd ~'
@mrjk
mrjk / vimrc.local
Last active November 13, 2024 15:43
System wide Debian sane vimrc for devops
" Source: https://gist.github.com/mrjk/1d146a701b201e77279ea4e7c5d075a5
" Last update: 2024/11/13
" Place this in /etc/vim/vimrc.local for debian based distros
" Place this in /etc/vimrc.local for rhel based distros
" Debian specifities
if filereadable("/usr/share/vim/vim80/defaults.vim")
source /usr/share/vim/vim80/defaults.vim
endif
" now set the line that the defaults file is not reloaded afterwards!
@mrjk
mrjk / gist:7098e4b882025e777407e2ea8a3b7676
Created November 11, 2022 22:42
poetry-bug-report-broken-pipe
[tool.poetry]
name = "python-project-poetry-template"
version = "0.1.0"
description = "Python Project Poetry Template"
authors = ["mrjk"]
license = "GPLv3"
packages = [
{ include = "myprj"}
]
@mrjk
mrjk / merge_dirs
Created December 14, 2022 09:27
Merge two directory and does not overwrite things.
#!/bin/bash
# To install in in: /usr/local/bin/merge_dirs
# Then: chmod +x /usr/local/bin/merge_dirs
set -eu
# Source: https://unix.stackexchange.com/a/155633
# Usage: like mv but: SRC DEST
@mrjk
mrjk / README.md
Created January 19, 2023 05:09
How to tcpdump a docker container interface from host?

How to find which container map on the host

$ docker exec -ti $container cut -d: -f1 /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo
  eth0
  eth1
 eth2