Skip to content

Instantly share code, notes, and snippets.

View gmolveau's full-sized avatar

Grégoire MOLVEAU gmolveau

View GitHub Profile
@gmolveau
gmolveau / fsck_fix.sh
Last active September 11, 2023 21:50
fsck exited with status code 4 (initramfs)
#/dev/sda5: recovering journal
#/dev/sda5 contains a file system with errors, check forces.
#/dev/sda5:
#Inodes that were part of a corrupted system orphan linked list found.
#
#/dev/sda5: UNEXPECTED INCONSISTENCY: RUN fsck MANUALLY.
# (i.e., without -a or -p options)
#fsck exited with status code 4
#the root filesystem on /dev/sda5 requires a manual fsck
#Busybox v [...]
@gmolveau
gmolveau / finder_macos_new_text_file_automator.md
Last active September 11, 2023 18:56
Create a new text file in the finder with Automator and Quick Action
  • open automator
  • create new quick action
  • workflow received no input in Finder.app
  • search run apple script and double-click on it
  • replace code with :
tell application "Finder"
    set txt to make new file at (the target of the front window) as alias with properties {name:"newfile.txt"}
 select txt
@gmolveau
gmolveau / diff-so-fancy-install.sh
Created July 29, 2020 19:28
ubuntu/debian diff-so-fancy install
# tired of "Unable to locate package diff-so-fancy ?"
# choose a folder that is in your PATH or create a new one
mkdir -p ~/bin
# add ~/bin to your PATH (.bashrc or .zshrc)
cd ~/bin
git clone https://github.com/so-fancy/diff-so-fancy diffsofancy
chmod +x diffsofancy/diff-so-fancy
ln -s ~/bin/diffsofancy/diff-so-fancy ~/bin/diff-so-fancy
@gmolveau
gmolveau / bash_list_missing_dependencies.sh
Last active July 25, 2023 14:37
bash script - list all missing dependencies and exit
# inspiration : https://stackoverflow.com/a/52552095
deps=0
for app in awk wget; do
! command -v ${app} &> /dev/null && echo "$app is not installed" && deps=1
done
[[ $deps -ne 0 ]] && exit 1
@gmolveau
gmolveau / tinyRules.css.md
Created January 13, 2022 15:13 — forked from paceaux/tinyRules.css.md
Tiny rules for how to name things in CSS and JS

Tiny rules for how to name stuff

CSS

How to name CSS classes

Stateful Class names

Is it a state that is only one of two conditions? (i.e. a boolean)

@gmolveau
gmolveau / bash_multiple_commands_parallel.sh
Created July 8, 2023 11:27
bash run multiple commands in parallel
# source : https://stackoverflow.com/a/52033580
# the wait allows COMMAND2 to finish before COMMAND1
# the trap allows the user to kill all the commands with one control-c
(trap 'kill 0' SIGINT; COMMAND1 & COMMAND2 & wait)
@gmolveau
gmolveau / postman_install_without_snap.sh
Created June 14, 2023 13:42
Postman ubuntu install without snap
# ubuntu install Postman without snap
DOWNLOAD_PATH="${HOME}/Downloads"
POSTMAN_FILENAME="postman-linux-x64.tar.gz"
POSTMAN_DOWNLOAD_PATH="${DOWNLOAD_PATH}/${POSTMAN_FILENAME}"
POSTMAN_URL="https://dl.pstmn.io/download/latest/linux_64"
wget -c "${POSTMAN_URL}" -O "${POSTMAN_DOWNLOAD_PATH}"
sudo rm -rf /opt/Postman/
@gmolveau
gmolveau / download_docker_macos10.txt
Created April 30, 2023 21:35
macos install docker previous version before macos 11
Latest docker version to support macos 10 => https://desktop.docker.com/mac/main/amd64/93002/Docker.dmg
https://docs.docker.com/desktop/release-notes/#4150
@gmolveau
gmolveau / embed_sub.md
Last active April 5, 2023 16:00
Embed subtitle (soft) in mp4/mkv file with ffmpeg without re-encoding

solution from https://stackoverflow.com/a/17584272/2627873

This solution adds the subtitles to the video as a separate optional (and user-controlled) subtitle track.

So you can choose the subtitle in VLC for example, it's not hard-coded or burned-in. And it won't re-encode the entire file so it's really fast.

  • ffmpeg is required
  • movie = great_movie.mp4 (works with mkv too)
  • subtitle = great_movie.english.srt
@gmolveau
gmolveau / markdown-bash-execute.md
Last active March 28, 2023 16:19
Markdown Bash Execute

Markdown Bash Execute

  • Execute bash code block from a markdown file → ```bash [...] ```

Getting started

  • add this to your .bashrc or .zshrc or .what-ever.rc
# markdown bash execute