Skip to content

Instantly share code, notes, and snippets.

View ClemRz's full-sized avatar
💰
Doing cool stuff for fintech industry

Clément Ronzon ClemRz

💰
Doing cool stuff for fintech industry
View GitHub Profile
@ClemRz
ClemRz / bat_pack_capacity.md
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.

@ClemRz
ClemRz / readme.md
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)
@ClemRz
ClemRz / readme.md
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
@ClemRz
ClemRz / _readme.md
Last active August 28, 2023 14:15
Trail maps production with QGIS
@ClemRz
ClemRz / QgsDetectLastFeature.py
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.
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)
@ClemRz
ClemRz / print 2D Sketchup to scale.md
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)
  2. Import the STL file in a new TinkerCAD model: https://www.tinkercad.com
  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

@ClemRz
ClemRz / _readme.md
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!

@ClemRz
ClemRz / _readme.md
Last active September 2, 2024 11:55
This is how you download a KML from alltrails.com without needing a PRO account.
@ClemRz
ClemRz / readme.md
Last active August 31, 2017 20:38
This is how you download vectorial OSM data for your QGIS map

How to import OSM vectorial data into QGIS

Follow the steps:

  1. Go to https://www.openstreetmap.org and log in
  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
@ClemRz
ClemRz / readme.md
Created August 31, 2017 19:04
This is a guide to add vectorial forest data to your QGIS map.

How to add vectorial PALSAR-2 Global Forest data in QGIS

Follow those simple steps:

  1. Go to http://www.eorc.jaxa.jp/ALOS/en/palsar_fnf/data/index.htm and select latest FNF map.
  2. Select the region and sub-region
  3. Download the FNF file
  4. In your QGIS project open the file that has no extension
  5. If you need to merge several FNF files, save them first as GTIFF (raster) and use the merge tool in the raster menu
  6. In the raster menu select Conversion > Polygonize, remember to check the "field name" checkbox