Skip to content

Instantly share code, notes, and snippets.

View ychaouche's full-sized avatar

Yassine Chaouche ychaouche

View GitHub Profile
root@clone-messagerie[10.10.10.19] ~ # tr -d '\n' < /tmp/trexample | tr -d '\n'
line1line2root@clone-messagerie[10.10.10.19] ~ #
root@clone-messagerie[10.10.10.19] ~ #
root@clone-messagerie[10.10.10.19] ~ # cat /tmp/trexample
line1
line2
root@clone-messagerie[10.10.10.19] ~ #
root@clone-messagerie[10.10.10.19] ~ # mail.user.detail "$mail"
*************************** 1. row ***************************
FN:BOUKHAROUBA Sedik
[email protected]
TITLE:Sous-Directeur de station
X-DEPARTMENT:Radio M’Sila
TEL;TYPE=home:5028
BDAY;VALUE=date:2023-10-24
root@clone-messagerie[10.10.10.19] ~ # mail.user.detail "$mail" | grep -E 'TITLE|X-DEPARTMENT'
TITLE:Sous-Directeur de station
Outside of tmux, PATH is exported and has this value:
root@clone-messagerie[10.10.10.19] ~ # export | grep PATH
declare -x AWKPATH="~/SYNCHRO/lib/"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/scripts/exploit--:/usr/local/scripts/exploit.tmp:/usr/local/scripts/mail:/usr/local/scripts/shorewall:/root/SYNCHRO/bin"
root@clone-messagerie[10.10.10.19] ~ #
Now inside of tmux :
@ychaouche
ychaouche / _txt.column.select.awk
Created September 24, 2025 14:09
column selection with awk
BEGIN {
split(COLS,columns_array,",");
for (i in columns_array){
col=columns_array[i];
n=split(col,range,"-");
if (n>1) {
min=range[1];
max=range[2];
@ychaouche
ychaouche / awk cut
Created September 24, 2025 13:57
awk code doens't preserve formatting
14:55:46 ~ -1- $ ls | head | awk '{$2=$3=$4=""; print}'
total
-rw-r--r-- 20K Jun 4 2024 absences.ods
-rw-r--r-- 7.1K Jun 4 2024 absences.xlsx
-rw-r--r-- 11K Mar 14 2023 ahmed.pdf
-rw-r--r-- 66K Mar 14 2023 ahmed.png
-rw-r--r-- 7.0K Mar 14 2023 ahmed.txt
drwxr-xr-x 4.0K Nov 5 2024 APPS
drwxr-xr-x 4.0K Jul 17 19:46 AUDIO
-rw-r--r-- 19K Apr 9 2023 bash.ps
@ychaouche
ychaouche / smtp
Created September 17, 2025 09:57
[...] smtp[...] E5A5E1C00096: to=<...>, relay=127.0.0.1[127.0.0.1]:10024, [...] queued as D3D291C000A7)
[...] smtp[...] E5A5E1C00096: to=<...>, relay=127.0.0.1[127.0.0.1]:10024, [...] queued as D3D291C000A7)
[...] smtp[...] E5A5E1C00096: to=<...>, relay=127.0.0.1[127.0.0.1]:10024, [...] queued as D3D291C000A7)
[...] smtp[...] E5A5E1C00096: to=<...>, relay=127.0.0.1[127.0.0.1]:10024, [...] queued as D3D291C000A7)
[...] smtp[...] E5A5E1C00096: to=<...>, relay=127.0.0.1[127.0.0.1]:10024, [...] queued as D3D291C000A7)
[...] smtp[...] E5A5E1C00096: to=<...>, relay=127.0.0.1[127.0.0.1]:10024, [...] queued as D3D291C000A7)
@ychaouche
ychaouche / txt.replace
Created September 16, 2025 15:11
txt.replace
Usage:
txt.replace -f fieldnumber -c command
Example:
Change the formatting of numbers in the output of ls
16:09:24 ~/MUSIQUE/CONTENT/RAM -1- $ command ls -l
total 73576
-rw-r--r-- 1 ychaouche ychaouche 5443123 Mar 9 2025 10.mp3
-rw-r--r-- 1 ychaouche ychaouche 4434170 Mar 9 2025 11.mp3
#250824 13:50:36 server id 1 end_log_pos 52469755 CRC32 0x73d17664 Query thread_id=189646 exec_time=0 error_code=0
SET TIMESTAMP=1756039836/*!*/;
COMMIT
/*!*/;
# at 52469755
#250824 13:59:06 server id 1 end_log_pos 52469797 CRC32 0xfebe2cd6 GTID 0-1-287315
/*!100001 SET @@session.gtid_seq_no=287315*//*!*/;
BEGIN
/*!*/;
# at 52469797
@ychaouche
ychaouche / apt error
Created August 20, 2025 17:23
apt error
root@app-server[10.10.10.83] ~ # apt-get update
Hit:1 http://security.debian.org/debian-security bookworm-security InRelease
Hit:2 http://deb.debian.org/debian bookworm InRelease
Hit:3 http://deb.debian.org/debian bookworm-updates InRelease
Reading package lists... Done
W: Skipping acquire of configured file 'updates/source/Sources' as repository 'http://security.debian.org/debian-security bookworm-security InRelease' doesn't have the component 'updates' (component misspelt in sources.list?)
W: Skipping acquire of configured file 'updates/binary-amd64/Packages' as repository 'http://security.debian.org/debian-security bookworm-security InRelease' doesn't have the component 'updates' (component misspelt in sources.list?)
W: Skipping acquire of configured file 'updates/i18n/Translation-en_US.UTF-8' as repository 'http://security.debian.org/debian-security bookworm-security InRelease' doesn't have the component 'updates' (component misspelt in sources.list?)
W: Skipping acquire of configured file 'updates/i18n/T
@ychaouche
ychaouche / why remove mariadb?
Created August 19, 2025 09:26
why remove mariadb?
root@app-server[10.10.10.83] ~ # apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
default-mysql-server dh-python emacs24-nox g++-6 galera-3 libaio1 libbabeltrace-ctf1 libbind9-140 libblas-common libboost-filesystem1.62.0 libboost-iostreams1.62.0 libboost-system1.62.0 libconfig-inifiles-perl libdbd-mysql-perl
libdbi-perl libdbus-glib-1-2 libdns162 libevent-2.0-5 libgfortran3 libgmime-2.6-0 libisc160 libisccc140 libisccfg140 libjemalloc1 libjs-angularjs libjs-lodash liblwres141 libmagickcore-6.q16-3 libmagickwand-6.q16-3 libnotmuch4
libperl5.24 libpython3.5 libpython3.5-minimal libpython3.5-stdlib libreadline5 libsnappy1v5 libstdc++-6-dev libtalloc2 libterm-readkey-perl libunbound2 libwebpmux2 libxerces-c3.1 libxml-security-c17v5 mariadb-client-10.3
mariadb-client-core-10.3 mariadb-server-10.3 mariadb-server-core-10.3 php7.0-dev python-gpgme python-idna python-oauth python-pyasn1 python