Skip to content

Instantly share code, notes, and snippets.

View scls19fr's full-sized avatar

Sébastien Celles scls19fr

View GitHub Profile
@scls19fr
scls19fr / slew_rate_limiter.py
Created February 29, 2024 13:29
Slew rate limiter - Python implementation
class SlewRateLimiter:
def __init__(self, slew_rate, neg_slew_rate=None, t_init=0, y_init=0.0):
self.slew_rate = slew_rate
if neg_slew_rate is None:
self.neg_slew_rate = -slew_rate
else:
self.neg_slew_rate = neg_slew_rate
self.t = t_init
self.y = y_init
@scls19fr
scls19fr / quantization.py
Last active February 29, 2024 12:58
Python Numpy - quantization of signal - example of a 2 bits quantization
# https://stackoverflow.com/questions/38152081/how-do-you-quantize-a-simple-input-using-python
def clamp(x: float, x_min=0.0, x_max=1.0):
"""
clamp a value to be within two bounds
returns lo if x < lo, hi if x > hi else x
"""
return min(x_max, max(x, x_min))
@scls19fr
scls19fr / boxstarter.ps1
Created July 3, 2023 17:13 — forked from ghostinthewires/boxstarter.ps1
Boxstarter Commands for a new Windows machine.
# Description: Boxstarter Script
# Author: https://twitter.com/GhostInTheWire5
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
# NOTE the "." above is required.
#
# Run this boxstarter by calling the following from **elevated** powershell:
# example: Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/ghostinthewires/033276015ba9d58d1f162e7fd47cdbd3/raw/boxstarter.ps1 -DisableReboots
# Learn more: http://boxstarter.org/Learn/WebLauncher
#! /usr/bin/python
# coding=utf-8
import requests
# Track ids to download
tracks = [
'9319946',
'9319955',
...
@scls19fr
scls19fr / luxorminifb.jl
Created November 16, 2021 13:23 — forked from cormullion/luxorminifb.jl
Luxor -> MiniFB test
using Luxor, MiniFB, Colors
mutable struct Guilloche
f1::Float64
f2::Float64
f3::Float64
f4::Float64
# damping factors: increase to make the energy losses faster
xd1::Float64
xd2::Float64
@scls19fr
scls19fr / gist:e0eb768a78198197e1a59ee10a94805e
Created April 4, 2021 19:57 — forked from cquest/gist:9db8aebcaa1fb1b53b2424c74b821b39
Téléchargement couche DRONES depuis Géoportail
# génération auto par gdal du fichier XML de description du service WMTS
gdal_translate "WMTS:https://wxs.ign.fr/an7nvfzojv5wa96dsga5nk8w/geoportail/wmts?Service=WMTS&Request=GetCapabilities&Version=1.0.0,layer=TRANSPORTS.DRONES.RESTRICTIONS" drones.xml -of WMTS
# téléchargement des tuiles et sortie en geotiff
gdal_translate drones.xml drones.tif -co COMPRESS=DEFLATE -co TILED=YES
@scls19fr
scls19fr / Out-AIRACCycles.ps1
Created February 5, 2021 08:06 — forked from a4099181/Out-AIRACCycles.ps1
AIRAC dates generator - enumerates AIRAC cycles: previous, current and next.
Function Out-AIRACCycles
{
Param ( [DateTime] $currentDay = ( Get-Date )
, [DateTime] $initialDay = ( Get-Date -Year 2015 -Month 1 -Day 8 )
, $interval = 28
, $culture = [System.Globalization.CultureInfo]::GetCultureInfo("en-US") )
$offset = (New-TimeSpan -Start $initialDay -End ( Get-Date -Year ( $currentDay.Year - 1 ) -Month 1 -Day 1 ) ).Days
$offset .. ( $offset + 365 * 3 ) |
@scls19fr
scls19fr / Vagrantfile
Created January 2, 2021 21:19 — forked from akrabat/Vagrantfile
Example Vagrantfile for Windows
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Base box: https://github.com/akrabat/packer-templates
Vagrant.configure("2") do |config|
config.vm.box = "19ft/windows2016"
config.vm.guest = :windows
config.vm.boot_timeout = 600
@scls19fr
scls19fr / BoxStarter_script_PcBasique
Created January 2, 2021 15:39 — forked from Akipe/BoxStarter_script_PcBasique
Script pour BoxStarter, après installation de Windows pour PC
#######################################################################
#### Script Boxstarter maintenance PC ####
#### Installation et mise en route des application pour PC basique ####
#######################################################################
########## Définition des paramétre Windows
Set-StartScreenOptions -EnableBootToDesktop
Set-TaskbarOptions -Lock
########## Mise à jour Windows
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.