Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Eddy-Barraud's full-sized avatar

Eddy Barraud Eddy-Barraud

View GitHub Profile
@Eddy-Barraud
Eddy-Barraud / round_on_error.py
Last active October 20, 2023 08:22
A python function to correctly print a value with its error in scientific format and the correct number of significant figures.
# 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):
@Eddy-Barraud
Eddy-Barraud / ffmpeg commands.md
Last active September 19, 2023 07:53
ffmpeg commands reminder

Print videos informations and streams

For all informations : ffmpeg -i input.mkv

For informations on streams : ffprobe -v error -show_entries stream=index,codec_name,codec_type input.mkv

[STREAM]
index=0
codec_name=h264
@Eddy-Barraud
Eddy-Barraud / playlist-all.sh
Created May 16, 2018 15:19
Create a Playlist of every songs inside every folders present at current directory
#!/bin/bash
#
# bash script to create playlist files in music subdirectories
# This one will aggregate every sonds inside only one same playlist
# Steve Carlson (stevengcarlson@gmail.com)
rm -f all.m3u
find . -type d |
while read subdir
do
# rm -f "$subdir"/*.m3u
@Eddy-Barraud
Eddy-Barraud / License.txt
Last active May 8, 2022 18:44
This Script allow reset the Windows Update Agent resolving issues with Windows Update. Comes from https://gallery.technet.microsoft.com/scriptcenter/Reset-Windows-Update-Agent-d824badc
MIT License
Copyright (c) 2018 Manuel Gil
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@Eddy-Barraud
Eddy-Barraud / Windows_Update_reboot.cmd
Last active May 8, 2022 18:44
Just reboot services linked to windows update
@echo off
echo Reminder: This must be run from an elevated command prompt!
pause
net stop wuauserv
net stop cryptSvc
net stop bits
net stop msiserver
ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
ren C:\Windows\System32\catroot2 catroot2.old
//Supprimer les scripts et css de la page d'accueil
function remove_scripts_home() {
if (is_home()){
wp_dequeue_script( 'script_handle' );
wp_deregister_script( 'script_handle' );
}
}
add_action('wp_print_scripts', 'remove_scripts_home', 100);
#!/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

Mount on O: drive letter your onedrive root folder as webdav and save the credentials.

net use O: https://d.docs.live.net/{cid}/ /savecred /p:yes

Detailled tuto here

sudo rm /etc/resolv.conf && sudo bash -c 'echo "nameserver 8.8.8.8" > /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 : 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):

rule

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.