Skip to content

Instantly share code, notes, and snippets.

View nim65s's full-sized avatar

Guilhem Saurel nim65s

View GitHub Profile
#!/usr/bin/env python
from __future__ import print_function
from hashlib import sha1
from hmac import new
from os import environ, system
from sys import stdin
KEY_FILE = '/etc/github.key'
@nim65s
nim65s / gist:5e9902cd67f094ce65b0
Created January 5, 2015 12:57
distance from point to line segment…
from numpy import arccos, array, dot, pi
from numpy.linalg import det, norm
def distance(A, B, P):
""" segment line AB, point P, where each one is an array([x, y]) """
if all(A == P) or all(B == P):
return 0
if arccos(dot((P - A) / norm(P - A), (B - A) / norm(B - A))) > pi / 2:
return norm(P - A)
if arccos(dot((P - B) / norm(P - B), (A - B) / norm(A - B))) > pi / 2:

I hereby claim:

  • I am nim65s on github.
  • I am nim65s (https://keybase.io/nim65s) on keybase.
  • I have a public key ASCgd5mnNlKwrj1d3uXD72ROcdHfDMX83nDK_iIoNVJIago

To claim this, I am signing this object:

{
@nim65s
nim65s / Effet_de_peau.ipynb
Created April 14, 2019 18:52
Effet de peau
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
from csv import reader
from datetime import date, timedelta
from os.path import isfile
import matplotlib.pyplot as plt
import requests
FILE = 'time_series_covid19_deaths_global.csv'
"""
Snippet to show how to make a loop run at a given frequency without drift.
"""
import signal
import time
from abc import ABCMeta, abstractmethod
DT_DISPLAY = 0.04 # 25 fps
@nim65s
nim65s / Dockerfile
Last active May 13, 2020 14:17
Check OpenGL on Docker with NVidia
FROM nvidia/opengl:1.0-glvnd-runtime-ubuntu18.04
RUN apt-get update -qqy && apt-get install -qqy mesa-utils
CMD glxgears
@nim65s
nim65s / test-mermaid.md
Created July 24, 2020 08:58
test mermaid
graph TD
A[Hard] -->|Text| B(Round)
B --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]
@nim65s
nim65s / lighter-meshes.py
Last active April 16, 2024 21:10
reduce mesh sizes
#!/usr/bin/env python
from os import chdir, walk
from pathlib import Path
from tempfile import TemporaryDirectory
from gepetto.corbaserver.client import Client
from meshcat import Visualizer, geometry, transformations
from pymeshlab import MeshSet