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
| { | |
| "version": 1.0, | |
| "categories": [ | |
| { | |
| "id": "IAB1", | |
| "category": "Arts & Entertainment", | |
| "hierarchy": "Arts & Entertainment" | |
| }, | |
| { | |
| "id": "IAB1-1", |
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
| use std::fs::File; | |
| use std::fs; | |
| use std::io::Write; | |
| pub fn collect_files(dir: &str, ext: &str) -> Vec<String> { | |
| let mut proto_files = Vec::new(); | |
| for entry in fs::read_dir(dir).expect("Directory not found") { | |
| let entry = entry.expect("Failed to read directory entry"); | |
| let path = entry.path(); | |
| if path.is_dir() { |
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 pathlib | |
| import importlib | |
| modules_dir = pathlib.Path(__file__).parent.absolute() | |
| module_files = [file.stem for file in modules_dir.iterdir() if file.suffix == ".py" and file.stem != "__init__"] | |
| for module_name in module_files: | |
| module = importlib.import_module(f"{module_name}") |
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
| adjectives = [ | |
| "quick", "lazy", "sleepy", "noisy", "hungry", "funny", "gorgeous", "grumpy", | |
| "fluffy", "bright", "silly", "messy", "shiny", "cheerful", "fancy", "crafty", | |
| "clever", "friendly", "jolly", "kind", "lively", "lucky", "merry", "neat", | |
| "nice", "polite", "proud", "silly", "thankful", "witty", "wonderful", "zany", | |
| "bouncy", "brave", "calm", "delightful", "eager", "faithful", "gentle", "happy", | |
| "jovial", "kind-hearted", "loving", "optimistic", "peaceful", "quirky", "reliable", | |
| "respectful", "thoughtful", "upbeat", "vivacious", "warm", "xenial", "youthful", | |
| "zealous", "amazing", "beautiful", "charming", "dazzling", "excellent", "fabulous", | |
| "graceful", "handsome", "ideal", "joyful", "magnificent", "novel", "outstanding", |
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 google.protobuf import json_format | |
| json_format.MessageToJson(message) | |
| json_format.Parse(json_string, my_proto_pb2.MyMessage()) |
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 importlib.util | |
| import sys | |
| # For illustrative purposes. | |
| name = 'itertools' | |
| if name in sys.modules: | |
| print(f"{name!r} already in sys.modules") | |
| elif (spec := importlib.util.find_spec(name)) is not None: | |
| # If you choose to perform the actual import ... |
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
| ssh-add - <<< "<private ssh>" |
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 simplified_scrapy.simplified_doc import SimplifiedDoc | |
| import html | |
| _special_chars = { | |
| "base": ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "!", "?", ".", ",", "\"", "'"], | |
| "special": { | |
| "serif_bold": ["๐", "๐", "๐", "๐", "๐", "๐", "๐ ", "๐ก", "๐ข", "๐ฃ", "๐ค", "๐ฅ", "๐ฆ", "๐ง", "๐จ", "๐ฉ", "๐ช", "๐ซ", "๐ฌ", "๐ญ", "๐ฎ", "๐ฏ", "๐ฐ", "๐ฑ", "๐ฒ", "๐ณ", "๐", "๐", "๐", "๐", "๐", "๐ ", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "โ", "โ", ".", ",", "\"", "'"], | |
| "serif_italic": ["๐", "๐", "๐", "๐", "๐", "๐", "๐", "โ", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐ ", "๐ก", "๐ข", "๐ฃ", "๐ค", "๐ฅ", "๐ฆ", "๐ง", "๐ด", "๐ต", "๐ถ", "๐ท", "๐ธ", "๐น", "๐บ", "๐ป", " |
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 download_from_gist(gist_id, outdir=None, encoding='utf-8'): | |
| import json, os | |
| from urllib.request import urlopen | |
| gist_api = urlopen("https://api.github.com/gists/" + gist_id) | |
| gist_json = json.load(gist_api) | |
| gist_src = {filename: urlopen(metadata['raw_url']).read().decode(encoding) for filename, metadata in gist_json['files'].items()} | |
| if outdir is None: | |
| from tempfile import mkdtemp |
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
| # pip install opencv-python | |
| import cv2 | |
| img = cv2.imread('hello_kitty.jpeg') | |
| print("Type:",type(img)) | |
| print("Shape:", img.shape) | |
| print("Dtype:", img.dtype) | |
| # Converting to RGB | |
| img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) |
NewerOlder