Skip to content

Instantly share code, notes, and snippets.

View oclero's full-sized avatar

Olivier Cléro oclero

View GitHub Profile
@oclero
oclero / windows_python_venv.ps
Created October 12, 2024 18:06
Windows Python Virtual Environment
python3 -m venv .venv
.\venv\Scripts\activate.bat
@oclero
oclero / waterwark_pdf.py
Created May 7, 2024 17:18
Add watermark to a PDF file with Python
import os
import sys
import getopt
import glob
import os.path
import fnmatch
from os import listdir
from os.path import isfile, join
from PyPDF2 import PdfFileReader, PdfFileWriter
@oclero
oclero / zip-macos.sh
Created February 7, 2024 21:44
MacOS - Create a ZIP archive without .DS_Store and __MACOSX files
zip -r output.zip path/to/input_folder -x ".DS_Store" -x "__MACOSX"
@oclero
oclero / remove-git-branch.sh
Created November 12, 2023 18:33
Remove a Git branch, local and/or remote
# Remove a remote branch.
git push <remote> --delete <branch>
# Remove a local branch.
git branch --delete <branch>
git branch --delete --force <branch>
# Remove a local tracking branch.
git branch --delete --remotes <remote>/<branch>
git fetch <remote> --prune
@oclero
oclero / push-to-https-repo.sh
Last active March 29, 2024 20:10
Push to Git repository with https on Gitlab/Github
# Gitlab
git push https://gitlab-ci-token:<YOUR_TOKEN>@gitlab.com/<GROUP_NAME>/<REPO_NAME>.git <BRANCH_NAME> [--force]
# Github
git push https://<USERNAME>:<YOUR_TOKEN>@github.com/<USERNAME>/<REPO_NAME> <BRANCH_NAME> [--force]
@oclero
oclero / jpegoptim-recursive.sh
Created October 23, 2023 10:43
Run jpegoptim recursively
find . \( -iname \*.jpg -or -iname \*.jpeg \) -print0 | xargs -P 4 -n 1 -0 jpegoptim
@oclero
oclero / prettier-config-vscode.md
Last active October 1, 2023 10:50
Prettier configuration for VS Code and Hugo

Standard Way

  1. At the root of the repository, create a .prettierrc file:

    {
      "plugins": ["prettier-plugin-go-template"],
      "overrides": [
        {
          "files": ["*.html"],
@oclero
oclero / get-commits-from-other-remote.sh
Created September 7, 2023 17:11
Get commits from another Git remote
git fetch other-remote
git merge other-remote/some-branch
@oclero
oclero / git-graph-terminal.sh
Created August 17, 2023 09:30
Get git commits log as a graph in terminal
git log --color --graph --abbrev-commit
@oclero
oclero / allow-vst.sh
Created July 1, 2023 08:38
Allow VSTs from unidentified developers on MacOS
#!/bin/sh
sudo xattr -rd com.apple.quarantine /Library/Audio/Plug-Ins/VST/*
sudo xattr -rd com.apple.quarantine /Library/Audio/Plug-Ins/VST3/*
sudo xattr -rd com.apple.quarantine /Library/Audio/Plug-Ins/Components/*