Skip to content

Instantly share code, notes, and snippets.

View ymollard's full-sized avatar
🐧
Art, engineering & digital training

Yoan Mollard ymollard

🐧
Art, engineering & digital training
View GitHub Profile
from datetime import datetime
from typing import Optional
class BankAccount:
def __init__(self, owner: str, initial_balance: int):
self.balance = initial_balance
self.owner = owner
def print(self):
from matplotlib import pyplot
class Scenario:
"""
Represents a scenario of virus propagation characterized by simulation parameters
Version with lockdowns but no incubation duration
"""
def __init__(self,
duration: int,

Gestion des images sous ROS et Marker RViz

  1. Tester le package usb_cam qui ouvre l'image de la webcam et la publie sur sur un topic (pour tester, affichez-la avec le package image_viewer)
  2. Ecrire un noeud color.py qui calcule la couleur dominante de l'image de ce topic et l'écrit dans le terminal
  3. Remplacer l'écriture dans le terminal par la publication d'un Marker dans RViz

Ronds et carrés Turtlesim : Roslaunch, rosparam et noeud

  1. Ecrire un noeud move_turtle.py qui fait dessiner un carré à la tortue de turtlesim
  2. Mettre le code du carré dans une fonction et écrire une autre fonction qui dessine un cercle
  3. Créer un package et un launchfile pour pouvoir lancer en une seule commande turtlesim et move_turtle.py en tapantn roslaunch formation dessin.launch
  4. Modifier le launchfile pour écrire square ou circle dans un paramètre /shape du serveur de paramètres selon ce qui est passé en argument e.g. draw.launch shape:=circle

Image to PDF

convert -density 300 in.jpeg out.pdf

Concat

sudo apt-get install pdftk
pdftk in1.pdf in2.pdf cat output out.pdf
@ymollard
ymollard / navigate.py
Last active May 31, 2022 13:55
english
#!/usr/bin/env python3
import rospy, actionlib, tf
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
from actionlib_msgs.msg import GoalStatus
from geometry_msgs.msg import Pose, Point, Quaternion
def goto(x, y, theta, timeout=120):
goal = MoveBaseGoal()
goal.target_pose.header.frame_id = 'map'
goal.target_pose.header.stamp = rospy.Time.now()
@ymollard
ymollard / jitsi_crop_1920x1080.bash
Last active March 14, 2021 01:38
Crop and blur Jitsi from 1920x1080 screen captures
#!/bin/bash
type convert || exit(1);
for i in Capture*png; do
convert "$i" \
-region 1600x800+300+200 -blur 0x9 \
"tmp-$i";
convert "tmp-$i" \
-crop 1920x930+0+120 \
File "/usr/share/system-config-printer/printerproperties.py", line 1425, in load
option.reinit (value, supported=supported)
File "/usr/share/system-config-printer/options.py", line 229, in reinit
self.set_widget_value (self.original_value)
File "/usr/share/system-config-printer/options.py", line 257, in set_widget_value
index = self.combobox_map.index (ipp_value)
ValueError: 0 is not in list
@ymollard
ymollard / count_files_by_extension.bash
Created December 9, 2020 21:54
Count files by extension
find -type f | rev | cut -d. -f 1 | rev | sort | uniq -c | sort -n
@ymollard
ymollard / mount_img.md
Last active October 20, 2021 20:23
losetup: Mount an img file with multiple partitions to edit files in them
sudo losetup 2020-10-23-poppy-torso.img -Pf
ll /dev/loop*

Then find the partition there eg /dev/loop15p2

mdkir -p mnt
@ymollard
ymollard / multipass.md
Last active February 4, 2021 14:35
Multipass VMs

Build a custom image

multipass launch           # will create a 20.04
sudo apt update
sudo apt upgrade
sudo apt install ubuntu-desktop xrdp
sudo passwd ubuntu         # Change the password