Skip to content

Instantly share code, notes, and snippets.

View hkboujrida's full-sized avatar

Haithem BOUJRIDA hkboujrida

View GitHub Profile
@hkboujrida
hkboujrida / custom-wsl-ubuntu-install.md
Last active March 31, 2024 17:55
custom wsl ubuntu install

Custom install ubuntu wsl2

Benefits:

  • no need to install ubuntu from the store
  • choose the version you want
  • choose the name you want
  • choose the location you want
  • install multiple versions of ubuntu

Install Ubuntu the classic way

@hkboujrida
hkboujrida / script
Last active December 22, 2023 10:49
pipelines
trigger:
- main
parameters:
- name: chartName
displayName: 'Select Helm Chart'
type: string
default: 'chart1'
values:
- chart1
provider "azurerm" {
features {}
}
data "azurerm_container_registry" "acr" {
name = var.registry_name
resource_group_name = var.resource_group_name
}
resource "azurerm_container_registry_task" "daily_purge_prod_images" {
# terraformer import azure -R edgeprime-oss -r subnet
# terraform plan -out=tfplan
# terraform show -json tfplan > plan.json
# bash script to automatically import state to terraform
#!/bin/bash
# get all the ressources id and name from the state file
file="imported.tfstate"
# jq '.modules[].resources | .[] | {type: .type, id: .primary.id, name: .primary.attributes.name}' "$file"
# put the ressources id and name, and type with jq into the variable ressources
existing_ressources=$(jq '[.modules[].resources | .[] | { type: .type, name: .primary.attributes.name, id: .primary.id}]' imported.tfstate)
@hkboujrida
hkboujrida / cidr
Last active March 1, 2024 13:08
cidr
output_address_cidr = "${join(".", [split(".", local.base_address)[0], split(".", local.base_address)[1], split(".", local.base_address)[2], split(".", split("/", local.other_address_cidr)[0])[3]])}/${split("/", local.other_address_cidr)[1]}"
docker run -it \
--name pytorch \
--network=host \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
--device=/dev/kfd \
--device=/dev/dri \
--group-add video \
--ipc=host \
--shm-size 8G \
# Powershell script to download and install grafana alloy in silent mode
# https://github.com/grafana/alloy/releases/download/v1.1.1/alloy-installer-windows-amd64.exe.zip
# Define the URL of the alloy installer
$url = "https://github.com/grafana/alloy/releases/download/v1.1.1/alloy-installer-windows-amd64.exe.zip"
# Define the path where the installer will be saved
$installerPath = "$env:TEMP\alloy-installer-windows-amd64.exe.zip"
# Download the installer
Invoke-WebRequest -Uri $url -OutFile $installerPath
cluster:
name: my-cluster
externalServices:
prometheus:
host: http://mimir-nginx.observability.svc:80
# queryEndpoint: /api/v1/push
writeEndpoint: /api/v1/push
authMode: none
tenantId: "1"
https://583c-77-201-81-191.ngrok-free.app/dashboards
# read a json local file from local disk and extract the build information
import json
import requests
json_url = 'http://localhost:8080/v1/rules'
# load json form url and extract the build information
json_file = requests.get(json_url).json()
# json_file = 'test.json'
# get base adress from json_url