Skip to content

Instantly share code, notes, and snippets.

@ArturoValv
ArturoValv / image_to_svg.php
Created February 7, 2025 22:21
Return SVG evaluating picture format by image array (ACF)
function image_to_svg($image)
{
if (!empty($image) && isset($image['url'], $image['mime_type'])) {
// Convertir la URL de la imagen a una ruta local si pertenece al sitio
$upload_dir = wp_get_upload_dir();
$image_path = str_replace($upload_dir['baseurl'], $upload_dir['basedir'], $image['url']);
// Verificar si el archivo existe en el servidor
if (file_exists($image_path) && $image['mime_type'] === "image/svg+xml") {
return file_get_contents($image_path);
@forkyau
forkyau / hourly_rainfall_data-2025-02-08|06-00.csv
Created February 7, 2025 22:21
GIST created by python code
id station stationid value unit obstime date
0 流浮山 RF001 0 mm 2025-02-08T06:00:00+08:00 2025-02-08
1 湿地公园 RF002 0 mm 2025-02-08T06:00:00+08:00 2025-02-08
2 水边围 N12 0 mm 2025-02-08T06:00:00+08:00 2025-02-08
3 石岗 RF003 0 mm 2025-02-08T06:00:00+08:00 2025-02-08
4 大美督 RF004 0 mm 2025-02-08T06:00:00+08:00 2025-02-08
5 大埔墟 RF005 0 mm 2025-02-08T06:00:00+08:00 2025-02-08
6 北潭涌 RF006 0 mm 2025-02-08T06:00:00+08:00 2025-02-08
7 滘西洲 RF007 0 mm 2025-02-08T06:00:00+08:00 2025-02-08
8 西贡 N15 0 mm 2025-02-08T06:00:00+08:00 2025-02-08
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense
from tensorflow.keras.datasets import mnist
from tensorflow.keras.utils import to_categorical
import numpy as np
# Load and preprocess the MNIST dataset
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train = x_train.reshape(-1, 28, 28, 1).astype('float32') / 255
x_test = x_test.reshape(-1, 28, 28, 1).astype('float32') / 255
@asan-emirsaleh
asan-emirsaleh / valgrind_v_anidesk.txt
Created February 7, 2025 22:20
valgrind debug on anydesk in verbose mode
$ valgrind -v --leak-check=full anydesk
==6159== Memcheck, a memory error detector
==6159== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==6159== Using Valgrind-3.24.0-fcdaa47426-20241101 and LibVEX; rerun with -h for copyright info
==6159== Command: anydesk
==6159==
--6159-- Valgrind options:
--6159-- -v
--6159-- --leak-check=full
--6159-- Contents of /proc/version:
# Homework: Loops
# 🔥Read carefully until the end before you start solving the exercises🔥
# Practice the Basics 💪🏻
# You can uncomment or type the necessary code on each task
# ---------------------------------------------------------------------
# Task 1. Create a basic for loop
@Teriks
Teriks / LLM4GEN.py
Created February 7, 2025 22:19
LLM4GEN demo
import huggingface_hub
import torch
import torch.nn as nn
from transformers import T5Tokenizer, T5PreTrainedModel, T5EncoderModel
from diffusers import StableDiffusionPipeline, UNet2DConditionModel
model_id = "sd-legacy/stable-diffusion-v1-5"
generator = torch.Generator("cuda").manual_seed(1)
@nuttxpr
nuttxpr / ci-arm-05.log
Created February 7, 2025 22:19
[arm-05] CI Log for nuttx @ ca6f5db6fc5d24ebe58be19c1cd7a5d0df856a64 / nuttx-apps @ fb0c1e10ded2a6fb9f066b9893662cbcc86e4646
Script started on 2025-02-08 04:18:10+07:00 [COMMAND="/home/user/nuttx-release/run-job.sh arm-05 " TERM="xterm-256color" TTY="/dev/pts/5" COLUMNS="110" LINES="83"]
Now running https://github.com/lupyuen/nuttx-release/blob/main/run-job.sh arm-05
Called by https://github.com/lupyuen/nuttx-release/blob/main/run-ci.sh
+ job=arm-05
+ [[ arm-05 == '' ]]
+ instance=
+ set
+ grep TMUX
+ true
+ neofetch
@mattharrison
mattharrison / accelerate-w-polars.ipynb
Created February 7, 2025 22:19
accelerate-w-polars.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Code Layout

  1. Brace and parenthesize in K&R style.
  2. Separate your control keywords from the following opening bracket.
  3. Don’t separate subroutine or variable names from the following opening bracket.
  4. Don’t use unnecessary parentheses for builtins and ‘honorary’ builtins.
  5. Separate complex keys or indices from their surrounding brackets.
  6. Use whitespace to help binary operators stand out from their
@DolphinOfficial
DolphinOfficial / PostShutdownFullLog.txt
Created February 7, 2025 22:18
Text file created by Roblox
-- AH POST-SERVER LOGS --
-- ServerID: c39ad165-93c4-4643-9818-0ebfec4f8e3b
-- Server started: February 07, 2025 10:10 PM UTC | Server uptime: 456 seconds
------------------ LOADB LOGS ------------------
{
}