Skip to content

Instantly share code, notes, and snippets.

View ychaouche's full-sized avatar

Yassine Chaouche ychaouche

View GitHub Profile
@ychaouche
ychaouche / add-newline-after-punctuation.el
Last active July 24, 2025 15:02
add-newline-after-punctuation.el
(defun add-newline-after-punctuation9 (start end)
"Place a newline after each sequence of 4 or more words followed by a comma, semicolon, colon, or period in the region."
(interactive "r")
(save-excursion
(goto-char start)
(while (re-search-forward "\\(\\w+\s+\\)\\{3,\\}\\w+\s*[.,:;])" end t)
(replace-match "\\&\n"))))
@ychaouche
ychaouche / lsync tutorial
Last active July 21, 2025 09:10
Lsync tutorial
Using lsyncd to synchronize file changes across multiple hosts
Posted 07-18-22 at 06:00 PM by ychaouche
Updated 05-30-23 at 07:12 AM by ychaouche
Tags live synchronization, lsyncd, rsync
In my own machine,
I create a directory named SYNC.
I put all the files I need to synchronize with other machines in there,
and have their original locations be symlinks to their new location inside the SYNC directory.
12:07:35 ~/NOTES/TXT -1- $ type net.paste0x0
net.paste0x0 is a function
net.paste0x0 ()
{
local useragent="net.paste0x0 by https://github.com/ychaouche";
echo "net.paste0x0 $1";
if (($#)); then
filepath="$1";
filename="$(basename "$filepath")";
mkdir /tmp/net.paste0x0/ 2> /dev/null;
@ychaouche
ychaouche / txt.headers
Last active July 15, 2025 11:05
Display headers from an outlined document
#!/bin/bash -i
# we need debug
file="$1"
sublevels=1
postprocess=cat
for arg
do
case "$arg" in
-[1-9])
@ychaouche
ychaouche / libx32
Last active February 27, 2025 16:54
/lib/ is for 32-bit apps
/libx32/ is for the 32x ABI
In the new "x32" ABI x86_64-linux-gnux32,
inspired by SGI n32 environment,
registers are 64 bits,
but pointers, integers and longs are only 32 bits,
saving a lot of memory in pointer-heavy workflows.
It also ensures all the other 64-bit only processor features are available,
resulting in to about 30% reduction in memory usage
function helpless() {
# ______________________________________________________________________
# /\ \
# \_| some commands don't support --help nor -h flags |
# | and so command --help or command -h results in a error exit code |
# | and a display of the "usage" on stderr. |
# | |
# | some other commands will tell you that --help isn't supported |
# | and print an error message that asks you to use -h instead |
# | |
15:22:19 ~ -1- $ apt-cache show libruby1.9.1 | grep -E '(Depends|Package)' | pretty.ellipsis
Package: libruby1.9.1
Depends: ruby1.9.1 (= 1.9.3.484-2ubuntu1.14), ca-certificates, libc6 (>= 2.14), libffi6 (>= 3.0.4), libgdbm3 (>= 1.8.3), libncursesw5 (>= 5.6+20070908), libreadline6 (>= 6.0), libssl1.0.0 (>= 1.0.0), libtinfo5, libyaml-0-2, zlib1...
Package: libruby1.9.1
Depends: ruby1.9.1 (= 1.9.3.484-2ubuntu1), ca-certificates, libc6 (>= 2.14), libffi6 (>= 3.0.4), libgdbm3 (>= 1.8.3), libncursesw5 (>= 5.6+20070908), libreadline6 (>= 6.0), libssl1.0.0 (>= 1.0.0), libtinfo5, libyaml-0-2, zlib1g (...
15:40:53 ~ -1- $ apt-cache show ruby1.9.1 | grep -E '(Depends|Package)' | pretty.ellipsis
Package: ruby1.9.1
Depends: ruby (>= 1:1.9.3.1), libruby1.9.1 (= 1.9.3.484-2ubuntu1.14), libc6 (>= 2.2.5)
Package: ruby1.9.1
Depends: ruby (>= 1:1.9.3.1), libruby1.9.1 (= 1.9.3.484-2ubuntu1), libc6 (>= 2.2.5)
root@messagerie-prep[10.10.10.19] ~ # ps x | sort -k 2 | head
1925 pts/0 Ss+ 0:00 -bash
28053 pts/1 R+ 0:00 ps x
28055 pts/1 S+ 0:00 head
28054 pts/1 S+ 0:00 sort -k 2
7695 pts/1 Ss 0:00 -bash
5126 pts/2 S+ 0:00 /bin/bash /root/SYNCHRO/bin/pretty.colorize.reverse (Firefox|Edge|Opera|Chrome)
5124 pts/2 S+ 0:03 tail -f /var/log/apache2/roundcube.access
5127 pts/2 S+ 0:06 sed -uE /(Firefox|Edge|Opera|Chrome)/!s/(.*)/\x1b[7m\1\x1b[0m/
5125 pts/2 S+ 0:26 /usr/bin/awk -f /root/SYNCHRO/bin/sys.log.apache.access.awkfilter
root@messagerie-prep[10.10.10.19] ~ # _asroot tcpdump -i eth0 -l -n "host 10.10.10.19 and (tcp[13]==2 or icmp or udp) and src net not (192.168.0.0/16 or 172.16.0.0/16 or 10.0.0.0/8) and port 53"
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
12:56:08.111496 IP 199.249.120.1.53 > 10.10.10.19.56505: 36063- 0/8/9 (821)
12:56:08.239833 IP 192.99.37.66.53 > 10.10.10.19.63603: 27326*- 1/4/8 TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsh9VtkDG1wmhnqLYLoSlnKcA0IA738GmsKa/HC2Q790KJkslz8Q3lq4W/1aeOPNxK0iASSWcetcbAI+KDGqxXf9UfRay8oSfNc+SmcFOihoY" "iwVcFnzoPfU0QZVLQUjKCKv2ovlkiMqT2NgZa7+i53DrcCzCwe06PbB6eXmMFD/eLSeinPqeMC9vdZ6AG/Y9LoBFCCqxTGJ4rSv6XzBzDOFPSYYFiKAZQBzX0q0oNxtEtextYOFGIaINtBpcA5cA9Z8EX4xqbgQS77fWi79TVSHWOXMITdvkoKyx6EeCPDEl3TwsfZmm2WqaRCrZJZfSgKtzmpM3UWJcM50Cn6J5ywIDAQAB" (716)
12:58:36.291710 IP 192.5.6.30.53 > 10.10.10.19.34266: 14639- 0/6/1 (477)
12:58:36.305884 IP 162.159.3.11.53
@ychaouche
ychaouche / pr -l11
Last active November 28, 2024 09:24
root@messagerie-prep[10.10.10.19] ~ # mail.dsn.report.failed | head | pr -l11
2024-11-28 10:03 Page 1
Nov 24 06:29:02 to=<[email protected]>, status=deferred (host mailstore1.secureserver.net[92.204.80.3] refused to talk to me: 554 sxb1plibsmtp01-30.prod.sxb1.secureserver.net CMGW IB106. Connection refused. 197.201.1.126 is listed on the Policy Block List (PBL).?? <http://www.spamhaus.org/query/ip/197.201.1.126> Please visit http://www.spamhaus.org/pbl/ for more information.)