Instantly share code, notes, and snippets.

💰
Doing cool stuff for fintech industry

# Clément Ronzon ClemRz

💰
Doing cool stuff for fintech industry
Created June 5, 2020 16:27
Formula to compute a lithium battery pack capacity

# Battery pack capacity formula

Use this formula to compute a lithium-ion battery pack capacity:

``````% = 1.25 * v / s - 3.875
``````

Where `%` is the remaining capacity as a fraction of `1` (multiply by `100` to get a percentage), `v` is the pack voltage and `s` is the number of cells in series.

Created September 9, 2019 14:54
Resize images and put them into a single pdf using ImageMagick

# Resize images and put them into a single pdf

First install ImageMagick

Run the following commands:

``````mogrify -resize 663x1024 *.jpg
for i in `seq 0 26`; do convert \$(printf "filename-%03d" \$i).jpg \$(printf "filename-%03d" \$i).pdf; done
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=temp.pdf \$(for i in `seq 0 26`; do printf "filename-%03d.pdf " \$i; done)
``````
Last active March 14, 2019 22:11
Extracts a CSV speed, elevation and distance table from a KML file.

# Extracts a CSV speed, elevation and distance table from a KML file.

This is a Python script that extracts a table with several columns from a KML file: timestamp, elapsed time, distance, speed, elevation, elev. gain, elev. loss and stop time.

## How to use this script

Open a terminal and run:

`python3 script.py /path/to/your/file.kml`
Last active August 28, 2023 14:15
Trail maps production with QGIS

# Trail maps production with QGIS

## Table of Content

Last active May 4, 2018 15:02
This python script can be used in QGIS actions. It allows to run a specific code on the very las feature when clicking on a stack of features.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 from PyQt4.QtCore import QSettings class Selection(QgsMapTool): def __init__(self, canvas, layer): QgsMapTool.__init__(self, canvas) self.canvas = canvas self.layer = layer def getFeatureRequest(self): sr = self.searchRadiusMU(self.canvas)
Last active March 3, 2018 18:59
How to print a 1:1 (or any scale) 2D graphic from a Sketchup Make 3D model

# How to print a 1:1 (or any scale) 2D graphic from a Sketchup Make 3D model

1. Export your model to STL file (Install the Sketchup STL extension: https://extensions.sketchup.com/en/content/sketchup-stl)
3. Export the TinkerCAD model to 2D SVG graphic
4. Open the SVG file in Inkscape
5. Make sure you page is correctly set up and print to the desired scale

The End

Created February 7, 2018 16:54
This is how you add more file fileds to the GPS Visualizer convertion tool

# How to add more file fields to the GPS Visualizer convertion tool

1. Go to http://www.gpsvisualizer.com/ and choose a file converter
2. Click the link `Show additional file input boxes`
3. Open the developper tool's console
4. Copy and paste the script below

Enjoy!

Last active May 31, 2024 15:07
This is how you download a KML from alltrails.com without needing a PRO account.
Last active August 31, 2017 20:38

# How to import OSM vectorial data into QGIS

2. On the right, open the layer menu and check the public GPS trace
3. On the top-left corner click on "Export"
4. Enter the coordinates
5. Click on Export button
6. Open the file with a text editor
Created August 31, 2017 19:04
This is a guide to add vectorial forest data to your QGIS map.