sudo rm /etc/resolv.conf && sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf' && sudo chattr +i /etc/resolv.conf
# Return the power of ten of a string in scientific notation | |
# "3.42e3" --> 3 | |
def get_power_of_ten(scientific_notation): | |
# Split the scientific notation into coefficient and exponent parts | |
coefficient, exponent = scientific_notation.split('e') | |
return int(exponent) | |
# Returns the value with significant figures up to the error position | |
# Example round_on_error(2.586e-1, 3.304e-2) => 2.6e-01 ± 3.3e-02 | |
def round_on_error(val, err): |
#!/bin/bash | |
#SBATCH --time=10-00:0:0 | |
#SBATCH --ntasks=1 | |
#SBATCH --nodes=1 | |
#SBATCH --cpus-per-task=12 | |
#SBATCH --mem-per-cpu=1024 | |
#SBATCH -J hPSP2 | |
# exit when any command fails | |
set -e |
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 : trevalim.fr/informatique/gpedit-on-windows-10-home/
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.
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
#!/bin/bash | |
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:127.0.0.1:[exposed-port] [server-IP]
runas /u:[my account]@outlook.com cmd.exe