Skip to content

Instantly share code, notes, and snippets.

View SalahEddineGhamri's full-sized avatar
🎯
tic tac toe

Salah SalahEddineGhamri

🎯
tic tac toe
View GitHub Profile
@SalahEddineGhamri
SalahEddineGhamri / custom_command.lua
Created December 16, 2025 15:02
custom command in neovim with arguments
local function greet_function(opts)
local name = opts.args or "World"
print("Hello, " .. name .. "!")
end
vim.api.nvim_create_user_command('Greet', greet_function, {
nargs = '?', -- Optional argument
desc = "Greet someone" -- Description for :help
})
@SalahEddineGhamri
SalahEddineGhamri / custom_command.lua
Created December 16, 2025 15:01
How to create a custom command in neovim
-- Define your function
local function my_function()
print("Hello from my function!")
-- Your code here
end
-- Create a user command
vim.api.nvim_create_user_command('MyCommand', my_function, {})
@SalahEddineGhamri
SalahEddineGhamri / simple_q_learning.py
Created December 7, 2025 01:00
a simple q learning implementation in python
"""
Simple Q learning algorithm with epsilon-greedy action choice
in q-learning algorithm we maintain a table of stats-actions q-values
after attributing the rewards to the goal states
the table is update based on bellman learning formula
to propagate the q values on the state-action back to the start
learning is done through episodes
in the end the result path is calculated from the learned policy