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 csv | |
| import operator | |
| from collections import defaultdict,Counter | |
| class DataFrame: | |
| def __init__(self,data,columns=None): | |
| if columns is not None: | |
| self.columns=list(columns) | |
| self.data=[dict(zip(columns,row))for row in data] | |
| elif data and isinstance(data[0],dict): |
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 sys | |
| import numpy as np | |
| from PIL import Image | |
| import argparse | |
| import os | |
| def create_autostereogram(pattern_path, depth_map_path, output_path, repeat_width=128): | |
| """ | |
| Generate an autostereogram from a pattern image and a depth map. |
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 System; | |
| using System.Linq; | |
| using System.Threading; | |
| using UnityEngine; | |
| using Random = System.Random; | |
| public class PixelThreading : MonoBehaviour | |
| { | |
| [SerializeField] private Material material; | |
| [SerializeField] private int width = 512; |
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 | |
| import random | |
| os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' | |
| from transformers import T5Tokenizer, TFT5ForConditionalGeneration | |
| model_sizes = ["small", "base", "large"] | |
| model_name = f'unicamp-dl/ptt5-{model_sizes[1]}-portuguese-vocab' | |
| tokenizer = T5Tokenizer.from_pretrained(model_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
| names = ["Fulano", "Sicrano", "Beltrano"] | |
| costs = [397.03, 199.42, 0] | |
| individual_cost = sum(costs) / len(costs) | |
| costs_str = "\n".join([f"{a} gastou R${b}" for a, b in zip(names, costs)]) | |
| print(f"Sabendo que:\n{costs_str}\n") | |
| print(f"E que o custo total foi R${sum(costs):.02f}\ne o individual foi R${individual_cost:.02f}\n") | |
| for n, c in zip(names, costs): | |
| specific_cost = individual_cost - c | |
| word = "receber" if specific_cost < 0 else "pagar" | |
| print(f"{n} deve {word}: R${abs(specific_cost):.02f}") |
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 glob import glob | |
| from moviepy.editor import * | |
| from tkinter import Tk | |
| from tkinter.filedialog import askdirectory | |
| from include.colors import Colors | |
| def get_filename(file_path): | |
| return file_path.split(os.sep)[-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
| SIZE=`xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/'` | |
| WIDTH=${SIZE%x*} | |
| HEIGHT=${SIZE#*x} | |
| echo "SIZE: $SIZE" | |
| echo "WIDTH: $WIDTH" | |
| echo "HEIGHT: $HEIGHT" | |
| echo | |
| WACOM_SIZE=`xsetwacom get 11 Area` |
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 cv2 | |
| from PIL import ImageGrab | |
| from screeninfo import get_monitors | |
| monitors = [] | |
| for m in get_monitors(): | |
| monitors.append((m.x, m.y, m.x + m.width, m.y + m.height)) | |
| bbox = monitors[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 datetime | |
| class Range: | |
| def __init__(self, start, end): | |
| self.start = min(start, end) | |
| self.end = max(start, end) | |
| self.empty = self.start == self.end | |
| self.log = False |
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 | |
| from PIL import Image | |
| arr = np.random.rand(256, 256, 4) * 255 | |
| img = Image.fromarray(arr.astype('uint8'), mode="RGBA") | |
| img.save("random_img.png") | |
| img.show() |
NewerOlder