Skip to content

Instantly share code, notes, and snippets.

View flavienbwk's full-sized avatar

Flavien Berwick flavienbwk

  • Montréal, Canada
  • 23:28 (UTC -04:00)
View GitHub Profile
@flavienbwk
flavienbwk / README.md
Last active October 27, 2023 00:27
LLMs translation benchmark comparison (Tatoeba fra to eng with 1000 sentences).

Values in bold represent the best value.

Metrics Google Translate Azure Translate Deepl Translate OpenAI GPT3.5-t OpenAI GPT4
Duration (s) 79.12 113.00 124.43 1820.75 1278.52
BLEU score 0.65 0.69 0.68 0.77 0.72
SacreBLEU score 53.36 55.21 53.08 58.59 57.27
Price* ($) 0.96 0.48 0.96 0.04 2.17
BLEU/price 0.68 1.44 0.71 19.25 0.332
Duration/price 82.42 235.42 182.98 2364.61 588.94
@flavienbwk
flavienbwk / list-and-delete-resources.txt
Last active August 5, 2023 15:15
List and delete resources from a resource group using the Azure API (can be used in runbooks then triggered by Logc Apps when budget is exceeded).
# List and delete resources from a resource group using the Azure API (can be used in runbooks then triggered by Monitor > Alerts > Create action groups when budget is exceeded).
# It requires an "Application Insights" resource.
# Configure the CLIENT_ID (Azure App Registration) to be able to read/delete RESOURCE_GROUP's resources in the IAM of
#
# Useful link : https://learn.microsoft.com/en-us/azure/cost-management-billing/manage/cost-management-budget-scenario#create-webhooks-for-the-runbook
the RESOURCE_GROUP.
import requests
def extract_type_prefix(input_string):
if '/' in input_string:
@flavienbwk
flavienbwk / keycloak-ca-install.sh
Created March 26, 2023 21:27
Script for installing Keycloak with self-signed certificate on a Kubernetes cluster.
#!/bin/bash
kubectl apply -f - <<EOF
---
apiVersion: v1
kind: Namespace
metadata:
name: keycloak
---
apiVersion: cert-manager.io/v1
@flavienbwk
flavienbwk / set_datetime_timezone.yml
Created November 26, 2022 17:10
Dummy example of a playbook defining the datetime and timezone of a server.
- name: Set datetime and timezone
hosts: prod-fr-zone-c-server-18
tasks:
- name: Set timezone
copy: content='Europe/Paris'
dest=/etc/timezone
- name: Set datetime
shell: date --set "25 Sep 2013 15:00:00"
@flavienbwk
flavienbwk / COMMAND_RM_DOCKER_IMAGE_TAGS.md
Created January 28, 2022 13:18
Remove all Docker images of a specific name (including all its tags)

Remove all Docker images (including its different tags) :

IMAGE="sameersbn/gitlab"
docker images | grep $IMAGE | tr -s ' ' | cut -d ' ' -f 2 | xargs -I {} docker rmi $IMAGE:{}
@flavienbwk
flavienbwk / jpg_to_webp.sh
Last active September 19, 2021 17:58
JPG to WEBp conversion in Linux Ubuntu. A good practice for lighter images on websites.
#First install the webp converter by this
sudo apt-get install webp
#go inside the directory where all images are there
#make sure all images are in RGB color mode, otherwise you will get error for CMYK images.
#Convert all images to RGB by this command (you should install ImageMagik to do that)
for f in *.jpg; do convert -colorspace RGB "$f" "${f}"; done
#finally convert all images to Webp format
for f in *.jpg; do cwebp -q 90 "$f" -o "${f%%.*}".webp; done
@flavienbwk
flavienbwk / SCREEN_COMMAND_GUIDE.md
Last active April 10, 2021 14:49
screen command tutorial

Using screen

Let's say you only have a terminal or a SSH access and want to perform multiple attached commands at the same time. E.g: wget.

Start a new screen

screen
@flavienbwk
flavienbwk / MIC-COMMANDS.md
Created January 27, 2021 23:03
Enable or disable your microphone loopback sound on Ubuntu.

Enable mic loopback

pactl load-module module-loopback latency_msec=1

Disable mic loopback

pactl unload-module module-loopback

#!/bin/bash
# Dynamically retrieves and add IPs from a list of domain names
# Creates a cache folder with IP as filenames to know if they have been added previously
# Manages both IPv4 and IPv6 rules.
MAIN_INTERFACE=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)
THIS_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"
CACHE_DIR="$THIS_DIR/.ips"
function is_ipv4()
@flavienbwk
flavienbwk / ZULIP-DOCKER-LDAP.md
Last active February 1, 2022 15:23
Example of Zulip docker-compose install with LDAP

How to install Zulip with Docker and LDAP authentication ?

0. Clone the docker-zulip repository

git clone https://github.com/zulip/docker-zulip
cd docker-zulip

1. Configure LDAP