Skip to content

Instantly share code, notes, and snippets.

View w6cloud's full-sized avatar
😁
Building our new platform!

Pierre Aboucaya w6cloud

😁
Building our new platform!
View GitHub Profile
@w6cloud
w6cloud / nvm-essentials.sh
Created December 22, 2023 19:48
Essential nvm.sh bash commands
#!/bin/bash
# Latest version install or update (close & open terminal after install)
tag="$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name')" && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$tag/install.sh | bash
# Update node to the latest LTS version & set as default + update npm + reinstall current packages
nvm install --lts --reinstall-packages-from=node --latest-npm --default
@w6cloud
w6cloud / latest-release-tag.sh
Created December 22, 2023 19:38
Get github repository latest release tag in bash
#!/bin/bash
# Source : https://gist.github.com/rponte/fdc0724dd984088606b0?permalink_comment_id=4508916#gistcomment-4508916
tag="$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name')"
echo $tag
@w6cloud
w6cloud / .env
Last active August 12, 2022 13:19
Structuring docker-compose.yml
# Application Environment [ string : dev|prod ]
# Determines the context :
# - dev : development (error message are shown, no cache...)
# - prod : production (no error essages, additionsal security measures, speed optimizations...)
APP_ENV=dev
# Configuration File [ string ]
# Path to the context specific environment
# Here to show a string interpolation example
APP_ADDITIONAL_CONF="./.env-${APP_ENV}"
@w6cloud
w6cloud / useful-docker-commands.md
Created May 12, 2020 00:06
Useful Docker commands

Useful Docker commands

Instances

List all running instances

docker ps -a
@w6cloud
w6cloud / useful-docker-commands.md
Created May 12, 2020 00:06
Useful Docker commands

Useful Docker commands

Instances

List all running instances

docker ps -a
@w6cloud
w6cloud / cloudflare-wp-page-rules.md
Last active May 7, 2020 20:16
CloudFlare page rules for WordPress
@w6cloud
w6cloud / yoast.md
Created April 15, 2020 18:30
Useful Yoast SEO tricks

Yoast SEO useful tricks

Get primary category

/**
 * Get the primary category
 * 
 * The first category is return as a fallback
 * 
@w6cloud
w6cloud / useful.md
Last active November 11, 2019 16:41
Useful bash commands

Useful bash commands

List of commands I often need but never remember... When there are functions shortcuts, I usualy put ththe code ~/.bash_functions and source it in ~/.bash_rc to make it globally available.

Search

Search files contining specific text

Search recursively in the folder ./ for files containing the pattern text.

@w6cloud
w6cloud / encode.sh
Last active November 5, 2019 15:20
Encode mp4 videos contained in a folder to OGG, WEBM, MP4
#!/bin/bash
# Based on https://gist.github.com/yellowled/1439610 & https://github.com/chuyskywalker/easy-web-video-encode/blob/master/encode.sh
CORES=$(grep -c ^processor /proc/cpuinfo)
if [ "$CORES" -gt "1" ]; then
CORES="$(($CORES - 1))"
fi
for filename in ./*.mp4; do
@w6cloud
w6cloud / extract-video-thumbnail.sh
Created October 24, 2019 10:07
Extract image from video
#!/bin/bash
########################################################################
#
# Creates a thumbnail extracted from a video
#
########################################################################
ffmpeg -i VIDEO.mp4 -ss 00:00:05.000 -f image2 -vframes 1 VIDEO.png