This file contains hidden or 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
def round_to_nearest_quarter_hour(minutes, base=15): | |
""" | |
Input: A value in minutes. | |
Return: An integer rounded to the nearest quarter-hour (0, 15, 30, 45) based on the base interval, | |
with special handling to ensure rounding from 0 up to 7 goes to 0 and 8 to 15 round to 15 | |
Example round_to_nearest_quarter_hour(0) rounds to 0 | |
round_to_nearest_quarter_hour(7) rounds to 0 | |
round_to_nearest_quarter_hour(8) rounds to 15 | |
round_to_nearest_quarter_hour(22) rounds to 15 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
SELECT c.cadaster_id, r.name | |
, CASE | |
WHEN ST_CoveredBy(c.geom, r.geom) | |
THEN c.geom | |
ELSE | |
ST_Multi( | |
ST_Intersection(c.geom,r.geom) | |
) END AS geom | |
FROM cadaster AS c | |
INNER JOIN roads_ply AS r |
This file contains hidden or 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
-- create a 0.5m buffer with square edges using mitre join | |
-- used for buffering building spaces to create a floor space | |
-- only taking 5 ids | |
SELECT fk_building_id, fk_building_floor_id, | |
st_multi(ST_Union(St_Buffer(b.geom,0.5,'endcap=square join=mitre mitre_limit=2'))) | |
AS geom FROM django.buildings_buildingfloorspace AS b | |
WHERE floor_num = 1 AND fk_building_id IN (2,3,6,7,8) | |
GROUP BY fk_building_id, fk_building_floor_id |
This file contains hidden or 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
<filter> | |
<filter-name>CorsFilter</filter-name> | |
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class> | |
<init-param> | |
<param-name>cors.allowed.origins</param-name> | |
<param-value>*</param-value> | |
</init-param> | |
<init-param> | |
<param-name>cors.allowed.methods</param-name> | |
<param-value>GET,POST,HEAD,OPTIONS,PUT</param-value> |
This file contains hidden or 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
// using font awesome 5 free version | |
var faFlagSolidStyle = new ol.style.Style({ | |
text: new ol.style.Text({ | |
text: '\uf024', // fas flag solid | |
scale: 1, | |
font: 'normal 18px FontAwesome', | |
offsety: -30, | |
offsetx: -10, | |
fill: new ol.style.Fill({color: 'black'}), | |
}) |
This file contains hidden or 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
# source: https://dev.to/mariamxl | |
# https://dev.to/mariamxl/dijkstras-algorithm-in-python-algorithms-for-beginners-dkc | |
from collections import deque, namedtuple | |
# we'll use infinity as a default distance to nodes. | |
inf = float('inf') | |
Edge = namedtuple('Edge', 'start, end, cost') |
This file contains hidden or 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
--QGIS 3 Ubuntu 16.04 | |
sudo sh -c 'echo "deb https://qgis.org/ubuntugis xenial main" >> /etc/apt/sources.list' | |
sudo sh -c 'echo "deb-src https://qgis.org/ubuntugis xenial main" >> /etc/apt/sources.list' | |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable | |
wget -O - https://qgis.org/downloads/qgis-2017.gpg.key | gpg --import | |
gpg --fingerprint CAEB3DC3BDF7FB45 | |
gpg --export --armor CAEB3DC3BDF7FB45 | sudo apt-key add - |
This file contains hidden or 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
class BoundingBox(coordinate_list): | |
""" | |
Return a 2D bounding box from a set of points | |
Example input: mypoints = [(0,2),(3,4),(5,6)] | |
Example Usage: BoundingBox(mypoints) | |
Example Usage: bbox = BoundingBox(mypoints) | |
bbox.width | |
bbox.height | |
bbox.centroid | |
""" |
This file contains hidden or 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
import os | |
from os.path import isfile, join | |
import shutil | |
my_path = "/home/username/Pictures" | |
file_types = ('.JPG', '.jpg', '.AVI') | |
year = '2010' | |
destination_folder = "/home/username/Pictures/final_2010" | |
for root, dirs, files in os.walk(my_path): |