Skip to content

Instantly share code, notes, and snippets.

View hayka-pacha's full-sized avatar

HKPA hayka-pacha

  • Somewhere, Cyberspace.
View GitHub Profile
@hayka-pacha
hayka-pacha / ssh_wait.tf
Created July 7, 2025 13:31
Terraform resource for check ssh (used for depends_on)
# Resource null pour attendre que SSH soit disponible
resource "null_resource" "wait_for_ssh" {
count = local.settings.ec2.enabled ? 1 : 0
depends_on = [module.ec2]
# Attendre que l'instance soit accessible via SSH
provisioner "remote-exec" {
inline = [
@hayka-pacha
hayka-pacha / delete_terminating_ns.sh
Created October 4, 2024 17:54
Delete terminating namespace
kubectl get namespace "stucked-namespace" -o json \
| tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" \
| kubectl replace --raw /api/v1/namespaces/stucked-namespace/finalize -f -
@hayka-pacha
hayka-pacha / get_latest_release.sh
Created October 12, 2021 19:36 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@hayka-pacha
hayka-pacha / flexible_engine_s3.py
Created September 16, 2021 11:27
Use boto3 on Flexible engine - OBS
import boto3
s3 = boto3.client(
's3',
aws_access_key_id="",
aws_secret_access_key="",
endpoint_url = "https://oss.eu-west-0.prod-cloud-ocb.orange-business.com"
)
# Retrieve the policy of the specified bucket
@hayka-pacha
hayka-pacha / docker-function.sh
Last active October 22, 2020 12:00
Fonctions Docker Bash
# Add it in .zshrc or .bashrc
function docker-destroy(){
docker rm -f $(docker ps -a -q) # Delete all containers
docker rmi -f $(docker images -q) # Delete all images
docker volume rm -f $(docker volume ls -f dangling=true -q) # Delete all volumes
docker system prune # Clear unused docker ressources
}
# Récupère l'adresse ip des conteneurs.
@hayka-pacha
hayka-pacha / install_zsh.sh
Last active June 23, 2022 19:27
Install ZSH and configure it
#/bin/bash
: << 'COMMENT'
### - Get packages from internet (Optionnal) - ###
Nerd Font - https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Hack/Regular/complete/Hack%20Regular%20Nerd%20Font%20Complete%20Mono.ttf
Dracula theme for iterm2 - color #84add4 - (Only MacOs) - curl https://github.com/dracula/iterm/archive/master.zip -o dracula.zip
### - Install Prerequisites - ###
apt install -y git zsh nano wget
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@hayka-pacha
hayka-pacha / slack.sh
Created August 24, 2019 11:40 — forked from andkirby/slack.sh
Shell/Bash script for sending slack messages.
#!/usr/bin/env bash
####################################################################################
# Slack Bash console script for sending messages.
####################################################################################
# Installation
# $ curl -s https://gist.github.com/andkirby/67a774513215d7ba06384186dd441d9e/raw --output /usr/bin/slack
# $ chmod +x /usr/bin/slack
####################################################################################
# USAGE
# Send message to slack channel/user
@hayka-pacha
hayka-pacha / delete-container.sh
Created March 14, 2019 15:29
Delete container if running
#!/bin/bash
CONTAINER=$1
RUNNING=$(docker inspect --format="{{ .State.Running }}" $CONTAINER 2> /dev/null)
if [ $? -eq 1 ]; then
echo "'$CONTAINER' does not exist."
else
/usr/bin/docker rm --force $CONTAINER
fi
@hayka-pacha
hayka-pacha / python_print_exemple.py
Created February 28, 2019 09:17
Python print exemple
print("connection to {0} {1}...".format(var0,var1))
@hayka-pacha
hayka-pacha / sed_use.sh
Last active March 18, 2019 10:01
Use of sed command
#!/bin/bash
sed -i 's/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g' filename
sed 's,http://www.find.com/page,http://www.replace.com/page,g' filename
sed -i '$ s/line number//g' file