Skip to content

Instantly share code, notes, and snippets.

View fgcarto's full-sized avatar

Francois Goulet fgcarto

View GitHub Profile
@fgcarto
fgcarto / graph_coloring.py
Created April 17, 2019 20:16 — forked from sramana/graph_coloring.py
Python Program for Graph Coloring Problem
colors = ['Red', 'Blue', 'Green', 'Yellow', 'Black']
states = ['Andhra', 'Karnataka', 'TamilNadu', 'Kerala']
neighbors = {}
neighbors['Andhra'] = ['Karnataka', 'TamilNadu']
neighbors['Karnataka'] = ['Andhra', 'TamilNadu', 'Kerala']
neighbors['TamilNadu'] = ['Andhra', 'Karnataka', 'Kerala']
neighbors['Kerala'] = ['Karnataka', 'TamilNadu']
@fgcarto
fgcarto / readme.md
Created October 11, 2018 19:11 — forked from kgjenkins/readme.md
Labels with callout lines in QGIS

Labels with callout lines in QGIS

Callouts, sometimes called leader lines, are lines between labels and features on a map. They are useful when constraints of space force a label to be moved away from the feature. The callout helps to reconnect the label to the feature it refers to.

image

There are probably multiple ways to do this, but here is one way using a geometry generator in QGIS 3.x:

@fgcarto
fgcarto / endofscript.py
Last active March 24, 2016 13:06
Function that return a quote when your script executes correctly. Just add "Print EndOfScript()" at the end...
###############################################################################
###############################################################################
def EndOfScript():
""" Sends back a "End of Script" message. Totally useless, but I was tired
sometime of debugging and need doing something fun ;) """
###############################################################################
import random
quotes = []
@fgcarto
fgcarto / ccog-readinglist.md
Created February 20, 2016 18:58 — forked from pramsey/ccog-readinglist.md
Canadian Council on Geomatics Reading List
@fgcarto
fgcarto / gares_amt.geojson
Last active February 8, 2016 15:27
Geojson des gares de l'AMT
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
Web Mercator Scale and Resolution Calculations
Python implementation of the formulas at http://msdn.microsoft.com/en-us/library/bb259689.aspx
"""
import math
def meters_per_pixel(zoom, lat):
"""
ground resolution = cos(latitude * pi/180) * earth circumference / map width
"""
@fgcarto
fgcarto / iteration.md
Last active August 29, 2015 14:15 — forked from tmcw/iteration.md
Itérations en javascript

What kind of iteration to use when in JavaScript

For loops

for (var i = 0; i < array.length; i++) {
}
  • Code has to run in old versions of IE.