A Pen by Mo Ismailzai on CodePen.
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
| from PIL import Image | |
| # Load created images; for example 4 | |
| amsterdam = Image.open('Amsterdam.png') | |
| hague = Image.open('The_Hague.png') | |
| rotterdam = Image.open('Rotterdam.png') | |
| utrecht = Image.open('Utrecht.png') | |
| # Retrieve width and height original images | |
| width = amsterdam.size[0] |
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 geopandas as gpd | |
| import matplotlib.pyplot as plt | |
| # Import all roads NL | |
| map_df = gpd.read_file('roads.shp') | |
| # Show data format | |
| map_df.head() | |
| # Set image properties | |
| fig, ax = plt.subplots(1, figsize=(10,14)) |
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 generate(c1,c2,bitlen): | |
| a = c1 & ~(1<<bitlen) | |
| b = c2 & ~(1<<bitlen) | |
| c = c1 >> 1 | |
| d = c2 >> 1 | |
| return (a&~b&~c&~d) | (~a&b&~c&~d) | (~a&~b&c&~d) | (~a&~b&~c&d) | |
| from collections import defaultdict | |
| def build_map(n, nums): | |
| mapping = defaultdict(set) |
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
| #include <iostream> | |
| #include <cmath> | |
| #include <iomanip> | |
| #include <atomic> | |
| #include <mutex> | |
| #include <thread> | |
| #include <condition_variable> | |
| #include <sstream> | |
| #include <vector> | |
| #include <fstream> |
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
| #!/usr/bin/python | |
| import turtle | |
| def draw_cesaro_line(turtle, level, length): | |
| if level == 0: | |
| turtle.forward(length) | |
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
| """ | |
| Produces load on all available CPU cores. | |
| Requires system environment var STRESS_MINS to be set. | |
| """ | |
| from multiprocessing import Pool | |
| from multiprocessing import cpu_count | |
| import time | |
| import os |
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 numpy as np | |
| import matplotlib.pyplot as plt | |
| def normalize(vector): | |
| return vector / np.linalg.norm(vector) | |
| def reflected(vector, axis): | |
| return vector - 2 * np.dot(vector, axis) * axis | |
| def sphere_intersect(center, radius, ray_origin, ray_direction): |

