Skip to content

Instantly share code, notes, and snippets.

View MateoGreil's full-sized avatar
🥃

Matéo MateoGreil

🥃
  • 03:52 (UTC +02:00)
View GitHub Profile
@MateoGreil
MateoGreil / n8n-qdrant-postgres-docker-compose.yml
Last active December 19, 2024 12:45
n8n + qdrant + postgres
# Inspired by https://github.com/siro83/n8n-starter/blob/main/docker-compose.yml
networks:
n8n:
services:
n8n:
image: n8nio/n8n:latest
networks: ['n8n']
environment:
- DB_TYPE=postgresdb
$darkmode: True;
$transparent: False;
$primary_paletteKeyColor: #d65d0e; // Orange pour les éléments principaux
$secondary_paletteKeyColor: #fabd2f; // Jaune pour les éléments secondaires
$tertiary_paletteKeyColor: #83a598; // Bleu pour les éléments tertiaires
$neutral_paletteKeyColor: #928374; // Gris pour les éléments neutres
$neutral_variant_paletteKeyColor: #7c6f64; // Gris foncé pour une variante neutre
$background: #282828; // Fond sombre Gruvbox
@MateoGreil
MateoGreil / MAGINON_AFS-1
Created August 30, 2022 20:21
MAGINON Feed Dispenser AFS-1 info
'HardWare': 'HI3516EV100_53H13L_FD_F4'
'SoftWareVersion': 'V4.03.R12.0002299E.12002.044602.0000000'
@MateoGreil
MateoGreil / benchmark_case_when_vs_if_else_for_compare_array.rb
Created February 8, 2022 13:15
benchmark_case_when_vs_if_else_for_compare_array
Benchmark.bm do |x|
count = 1_000_000
label_size = 7
array = [1, 2, 3, 4, 5, 'a', 'b']
x.report "case when".rjust(label_size) do
count.times {
case array
when proc { |a| %w[a b] - array == [] }
Benchmark.bm do |x|
count = 100_000_000
label_size = 7
results = Potential.joins(:pro_choices).first.pro_choices.joins(:pro_account)
.preferred_or_exclusive
.pluck('potential_pro_choices.choice, pro_accounts.first_name')
.group_by(&:first)
x.report "reverse!:".rjust(label_size) do
@MateoGreil
MateoGreil / benchmark ActiveRecord transaction.rb
Last active November 2, 2020 08:20
benchmark ActiveRecord query with and without transaction
def test
Benchmark.bm do |x|
count = 20
label_size = 28
x.report "without".rjust(label_size) do
count.times do
User.all.each(&:touch)
end
end
@MateoGreil
MateoGreil / benchmark.rb
Created July 22, 2020 16:25
benchmark.rb
require "benchmark"
Benchmark.bm do |x|
count = 10_000_000
label_size = 7
x.report "case when:".rjust(label_size) do
count.times {
variable = [:one, :two].sample
case variable
Benchmark.bm do |x|
count = 500
label_size = 28
x.report "maximum".rjust(label_size) do
count.times { CultivableZone.maximum(:integer) }
end
x.report "pluck.max".rjust(label_size) do
count.times { CultivableZone.pluck(:integer).max }
require "benchmark"
Benchmark.bm do |x|
count = 5_000_000
label_size = 7
x.report "str +:".rjust(label_size) do
count.times {
"foo" +
"bar"
@MateoGreil
MateoGreil / benchmarks.rb
Last active June 11, 2020 15:00
ruby 2.6 A story about time (ActiveSupport)
require "benchmark"
require "active_support/all"
Benchmark.bm do |x|
count = 5_000_000
label_size = 28
x.report "1.week:".rjust(label_size) do
count.times { 1.week }
end