Skip to content

Instantly share code, notes, and snippets.

@bdebon
bdebon / rodin.md
Created March 18, 2026 15:32
Rodin – Interlocuteur socratique pour discussions sociétales profondes — anti-chambre d'écho
name rodin
description Interlocuteur socratique pour discussions sociétales profondes — anti-chambre d'écho

Tu es Rodin, un interlocuteur intellectuel exigeant. Tu incarnes ce rôle pour toute la durée de la conversation. Ne brise jamais le personnage.

Activation

  1. Lis et intègre la synthèse portrait du portrait de l'utilisateur : [OPTIONEL A FAIRE DE VOTRE COTÉ] — c'est ton contexte permanent sur ton interlocuteur. Ne la résume pas, ne la mentionne pas. Intègre-la silencieusement.
@diodonfrost
diodonfrost / git-move-folder-with-history.sh
Last active September 5, 2023 21:19
Move folder and keep Git history
# Move/Rename folder "foo/my-old-folder" to "foo/my-new-folder" and keep history
git filter-branch -f --tree-filter 'test -d foo/my-old-folder && mv foo/my-old-folder foo/my-new-folder || echo "Nothing to do"' HEAD
@diodonfrost
diodonfrost / git-import.sh
Last active October 14, 2021 21:32
Move file to another repository while preserving git history
# Copied from https://stackoverflow.com/a/11426261/12560823
# Create git patch from the source repository
cd repository
git log --pretty=email --patch-with-stat --reverse --full-index --binary -- path/to/file_or_folder > patch
# Apply previous git patch to the destination repository
cd ../another_repository
git am --committer-date-is-author-date < ../repository/patch
@diodonfrost
diodonfrost / git-ignore-locally-modifications.sh
Last active July 20, 2021 22:54
Git: ignore files already managed with Git locally
# Tell to Git to ignore localy modifications that will be done on foo.txt
git update-index --skip-worktree ${PWD}/foo.txt
# Display ignored file
git ls-files -v
# Unset the ignore file
git update-index --no-skip-worktree ${PWD}/foo.txt
@diodonfrost
diodonfrost / git-sign-old-commits.sh
Last active July 21, 2021 19:35
Filter only specific commits and sign only them
# Filter only specific commits and sign only them
git filter-branch --commit-filter 'if [ "$GIT_COMMITTER_EMAIL" = "user@domain.com" ];
then git commit-tree -S "$@";
else git commit-tree --no-gpg-sign "$@";
fi' HEAD
git push --force
@DaisukeMiyamoto
DaisukeMiyamoto / assume_role.py
Created September 12, 2018 05:00
AWS Boto3 Assume Role example
import boto3
from boto3.session import Session
def assume_role(arn, session_name):
"""aws sts assume-role --role-arn arn:aws:iam::00000000000000:role/example-role --role-session-name example-role"""
client = boto3.client('sts')
account_id = client.get_caller_identity()["Account"]
print(account_id)
@BuildWithLal
BuildWithLal / python-singleton.py
Last active September 28, 2020 20:10
Create a singleton class using Python 3
class Singleton(object):
def __new__(cls):
if not hasattr(cls, 'instance') or not cls.instance:
cls.instance = super().__new__(cls)
return cls.instance
obj1 = Singleton()
obj2 = Singleton()
@gene1wood
gene1wood / 01_get_account_id_for_user_ec2instance_role_or_lambda.py
Last active March 20, 2025 20:13
Method to determine your AWS account ID using boto3 for either a user or an ec2 instance or lambda function
import boto3
print(boto3.client('sts').get_caller_identity()['Account'])
@whistler
whistler / import.sh
Created March 16, 2015 17:31
Copy files to another repository while saving git history
# copied from http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/
git clone <git repository A url> # clone source repository
cd <git repository A directory>
git remote rm origin # to make sure it doesn't affect the original repository
git filter-branch --subdirectory-filter <directory 1> -- --all # remove all files other than the ones needed
mkdir <directory 1> # move them into another directory where they will be stored in the destination repository (if needed)
mv * <directory 1>
git add .
git commit