Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| """ | |
| Code snippet to generate a scatter plot from a given image (mask). | |
| """ | |
| from PIL import Image | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| im = Image.open("image.png") | |
| mask = (np.array(im) > 0).any(axis=2) # masking condition |
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
| """ | |
| GPLv3 yadda yadda | |
| Flavio Giobergia | |
| https://gist.github.com/fgiobergia/395fb9b4727790e0a9a2d24d936526f1 | |
| """ | |
| def _merge(a: str, b: str, elisione: bool = True, spacing: bool = False, use_e : bool = False) -> str: | |
| """Utility function to merge two strings, following a bunch of rules, | |
| as explained in the documentation for int2ita | |
| """ |
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
| from lxml import html | |
| import requests | |
| import numpy | |
| page = requests.get('https://cloud.google.com/compute/pricing') | |
| tree = html.fromstring(page.content) | |
| lowest = tree.xpath('//table/tbody/tr/th[text()="Preemptible price"]/../../tr/td[5]/text()')[:18] | |
| lowest_preempt = tree.xpath('//table/tbody/tr/th[text()="Preemptible price"]/../../tr/td[8]/text()')[:18] |
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
| /* https://www.youtube.com/watch?v=7yDmGnA8Hw0 */ | |
| #include <stdio.h> | |
| #define LEN 4 | |
| int slowest (int *p) { | |
| return (p[0] > p[1]) ? p[0] : p[1]; | |
| } | |
| int try (int *side1, int *side2, int index, int time) { | |
| // using current and other for readability purposes |
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 <stdlib.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| #define f(x,y,z) ((x&y)|(~x&z)) | |
| #define g(x,y,z) ((x&z)|(y&~z)) | |
| #define h(x,y,z) (x^y^z) | |
| #define i(x,y,z) (y^(x|~z)) | |
| #define ror(x,c) ((x<<c)|(x>>(32-c))) |
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
| /* | |
| * Hex "editor": display, search and replace patterns in binary files | |
| * http://fgiobergia.com | |
| * The MIT License (MIT) | |
| * Copyright (c) 2014 Flavio Giobergia | |
| * http://opensource.org/licenses/MIT | |
| */ | |
| #include <unistd.h> | |
| #include <fcntl.h> |
NewerOlder