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 / _readme.md
Last active April 23, 2024 08:32
This is how you download a KML from alltrails.com without needing a PRO account.
@ClemRz
ClemRz / readme.md
Last active November 19, 2023 16:11
How to pass a callback function as an argument (Arduino, C++)

How to pass a callback function as an argument (Arduino, C++)

Arduino Uno:

bool myCallback(int value) {
  // here your custom logic
  return status;
}
@ClemRz
ClemRz / _readme.md
Last active August 28, 2023 14:15
Trail maps production with QGIS
@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 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
@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 October 1, 2018 17:48
Removes inaccurate point from a GPS trace.

Filter a KML by HDOP value

Sometimes a trace KML file obtained from a GPS has some points with high HDOP value. Those are usually not accurate and can be omitted from the trace.

How to use this script

Then open a terminal and run:

python zFilterByHdop.py /path/to/your/file.kml
@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