Skip to content

Instantly share code, notes, and snippets.

View guilyx's full-sized avatar
⚔️

Erwin Lejeune guilyx

⚔️
View GitHub Profile
@guilyx
guilyx / melodic_installer.sh
Last active April 9, 2020 14:58
ROS Melodic Install Script (Ubuntu 18.04)
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt update
sudo apt install ros-melodic-desktop-full
sudo rosdep init
@guilyx
guilyx / zsh_installer.sh
Created April 9, 2020 14:59
ZSH Installer
sudo apt install zsh
chsh -s /usr/bin/zsh
exit
gnome-terminal -e echo $SHELL
if [$SHELL = "/usr/bin/zsh"]
then
@guilyx
guilyx / go-template.go
Last active August 26, 2020 13:48
Simple example showing how to extract a string variable out of a go template.
package main
import (
"text/template"
"fmt"
"bytes"
"time"
"strconv"
)
@guilyx
guilyx / go-mail.go
Created August 26, 2020 13:46
A simple to use email wrapper
package main
import (
"fmt"
"net/smtp"
"strconv"
)
func SmtpAuthentification(username string, pwd string, host string) smtp.Auth {
return (smtp.PlainAuth("", username, pwd, host))
@guilyx
guilyx / triangles.py
Last active December 26, 2021 15:30
Pyramid/Triangles patterns printing stars
"""
Écrivez une fonction Python dont le nom commence par « triangle ».
Cette fonction prend un paramètre : le nombre de lignes à écrire.
Si le nombre de lignes est pair, la fonction ne doit rien afficher.
Sinon elle doit afficher un triangle composé d'étoiles précédées par des espaces.
Par exemple, si le nombre de lignes vaut 5, il faut afficher :
@guilyx
guilyx / gist:4fe0f950ecd9e8a91c04206011f7dde5
Created February 21, 2024 07:16
Python Clamp Function
def clamp(value, min_value, max_value):
return max(min_value, min(max_value, value))
@guilyx
guilyx / calculate_fov_from_camera_info.py
Last active June 7, 2024 08:41
Python script to calculate the horizontal and vertical Field of View (FOV) from a ROS2 CameraInfo message.
import math
from sensor_msgs.msg import CameraInfo
def calculate_fov(camera_info: CameraInfo):
"""
Calculate the horizontal and vertical Field of View (FOV) from a CameraInfo message.
Parameters:
camera_info (CameraInfo): ROS2 CameraInfo message containing intrinsic camera parameters.