Skip to content

Instantly share code, notes, and snippets.


Eddy Barraud Eddy-Barraud

View GitHub Profile
#SBATCH --time=10-00:0:0
#SBATCH --ntasks=1
#SBATCH --nodes=1
#SBATCH --cpus-per-task=12
#SBATCH --mem-per-cpu=1024
# exit when any command fails
set -e
View Modify resolv.conf

sudo rm /etc/resolv.conf && sudo bash -c 'echo "nameserver" > /etc/resolv.conf' && sudo chattr +i /etc/resolv.conf


If you are experiencing disconnections when you resume your always connected laptop/tab after sleep you can do the following :

Firstly, if you are using Windows 10 Home edition, enable gpedit by visiting this post :

After that, go inside Policy Plus and enable this rule System/PowerManagement/SleepOptions/Allow network connectivity during connected standby (battery):


Now you are sure that the device won't disconnect during sleep.

On top of that, you can disable hibernation (after long period of sleep) by enabling the "deactivate hibernation" option and specifying a time of 0sec for the delay.


To enable Gpedit on windows 10 HOME run the following :

Copy this inside a bat file :

@echo off 
pushd "%~dp0" 

dir /b %SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >List.txt 
dir /b %SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>List.txt 
Eddy-Barraud /
Last active Nov 22, 2020
Compress using fast ZSTD and show progress with dialog
filePath=$(wslpath "$1")
fileName=$(basename $filePath)
#cd $filePath/..
( pv -n $fileName | tar xf - -I"zstd -T0" ) 2>&1 | dialog --gauge "Progress..." 6 50

cat $file | tr " " "\n" | sort | uniq -c | sort

$file : Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse accumsan lobortis iaculis. Vestibulum eu condimentum sem. Nunc ut ipsum ipsum. Vestibulum venenatis suscipit ligula vel finibus. Donec dictum eros massa, nec congue justo rutrum et. Donec dictum sagittis dui a mollis. Nullam sed ipsum dapibus, tincidunt turpis a, vestibulum mauris. Cras quis dapibus diam. Donec tempus faucibus odio nec fringilla. Praesent feugiat mi libero, at placerat ante semper quis. Vestibulum id cursus eros.
$cat $file | tr " " "\n" | sort | uniq -c | sort
      1 Cras
      1 Lorem
      1 Suspendisse
      2 dictum
      2 nec

To expose a port inside a running docker container, you can create a temporary container connected to the same network. We will use socat to link the desired port to another exposed port.

docker run --rm --net some-network -p [exposed-port]:1234 verb/socat TCP-LISTEN:1234,fork TCP-CONNECT:[container-IP]:[container-port]

Then, for example, you can ssh forward this port to your localhost 80 port: ssh -N -L 80:[exposed-port] [server-IP]


This is a registry tweak tip

Windows is hidding a lot of options from the advanced power settings window. You can show options by going inside regedit at : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings Inside this folder there are a lot of subdirectories. Click on each one you want, 44f3beca-a7c0-460e-9df2-bb8b99e0cba6 for Intel Graphics as an example. You will find a

Eddy-Barraud / gethint.php
Last active May 6, 2019
Sample for converting textarea containing links with php & ajax
View gethint.php
$q = trim($_POST["q"]);
$lines = explode(PHP_EOL, $q);
$result = "";
foreach ($lines as $key => $value) {
$result .= $value . PHP_EOL;
echo $result;