Skip to content

Instantly share code, notes, and snippets.

View WillzWayn's full-sized avatar
🎯
Focusing

William Wayn WillzWayn

🎯
Focusing
  • Brazil, Rio de Janeiro.
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
sepal_length sepal_width petal_length petal_width species
5.1 3.5 1.4 0.2 setosa
4.9 3.0 1.4 0.2 setosa
4.7 3.2 1.3 0.2 setosa
4.6 3.1 1.5 0.2 setosa
5.0 3.6 1.4 0.2 setosa
5.4 3.9 1.7 0.4 setosa
4.6 3.4 1.4 0.3 setosa
5.0 3.4 1.5 0.2 setosa
4.4 2.9 1.4 0.2 setosa
@WillzWayn
WillzWayn / get_memory_size.py
Created January 21, 2025 00:23 — forked from philschmid/get_memory_size.py
Get needed GPU per precision for a Hugging Face Model Id
from typing import Dict, Union
from huggingface_hub import get_safetensors_metadata
import argparse
import sys
# Example:
# python get_gpu_memory.py Qwen/Qwen2.5-7B-Instruct
# Dictionary mapping dtype strings to their byte sizes
bytes_per_dtype: Dict[str, float] = {
@WillzWayn
WillzWayn / Obsidian RenderHeatmapCalendar Dynamic Filter
Created January 13, 2024 13:52
Este Gist contém um código em DataviewJS para o plugin Obsidian, utilizando o RenderHeatmapCalendar. O código permite a seleção dinâmica de uma variável para filtrar os dados exibidos no gráfico de calor. Além disso, inclui a opção de escolher entre diferentes variáveis de filtro usando uma caixa de seleção.
```dataviewjs
// Adicione uma caixa de seleção HTML para escolher a variável de filtro
const filterVariableSelect = document.createElement("select");
filterVariableSelect.innerHTML = `
<option value="Proudness">Proudness</option>
<option value="Writing">Writing</option>
<!-- Adicione mais opções conforme necessário -->
`;
this.container.appendChild(filterVariableSelect);
image=icons_finance01_new.jpg
size=$( identify -ping -format "%wx%h" "${image}" )
x_upb=${size%x*}
y_upb=${size#*x}
x_inc=350
y_inc=350
x_tile=350
y_tile=350
@WillzWayn
WillzWayn / check_correlation.py
Created November 15, 2020 00:54
Checar a correlação de features, usando apenas PANDAS.
# Create a correlation matrix
corr_metrics = df.corr()
corr_metrics.style.background_gradient()
def load_geom_labels(shp: Path):
from osgeo import ogr; ogr.UseExceptions()
'''
Read a .shp file and return rowidx, ID Field and geom.
returns dictionary
'''
ogr_ds = ogr.Open(str(shp))
ogr_lyr = ogr_ds.GetLayer()
@WillzWayn
WillzWayn / reproj_wgs84_4326_to_sirgas2000_4674.py
Last active August 13, 2020 19:20
Reprojeta uma geometria em wgs84 - 4326 para UTM sirgas 2000 - 4674
import pyproj
import shapely
from shapely.ops import transform
def reproj_polygon(geometry:shapely.geometry):
wgs84 = pyproj.CRS('EPSG:4326')
utm_sirgas_2000 = pyproj.CRS('EPSG:4674')
project = pyproj.Transformer.from_crs(wgs84, utm_sirgas_2000, always_xy=True).transform
@WillzWayn
WillzWayn / reduce_mem_usage_pandas.py
Created July 7, 2020 04:15
Reduzir o uso de memória usada por dataframe pandas
## Reduce memory usage
def reduce_mem_usage(df, verbose=True):
numerics = ['int16', 'int32', 'int64', 'float16', 'float32', 'float64']
start_mem = df.memory_usage().sum() / 1024**2
for col in df.columns:
col_type = df[col].dtypes
if col_type in numerics:
c_min = df[col].min()
c_max = df[col].max()
if str(col_type)[:3] == 'int':