Skip to content

Instantly share code, notes, and snippets.

View ziap's full-sized avatar

Zap ziap

View GitHub Profile
@ziap
ziap / fib-constexpr.cpp
Last active July 30, 2023 08:58
Calculate the first 100 Fibonacci numbers at compile time in C++
#include <array>
#include <iostream>
#include <stdint.h>
#include <stddef.h>
template<size_t N>
constexpr auto fib = ([]() constexpr {
std::array<uint64_t, N> result = {};
result[0] = 0;
result[1] = 1;
@ziap
ziap / 2048.ipynb
Last active April 28, 2022 15:39
2048.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/*========================================================================================================*
+-----+-----+-----+-----+-----+-----+-----+
| █▀▀ | ▄▀█ | █▀▀ | █▀▀ | ▄▀█ | █▀▄ | █▀▀ |
| █▄▄ | █▀█ | ▄▄█ | █▄▄ | █▀█ | █▄▀ | ██▄ |
+-----+-----+-----+-----+-----+-----+-----+ Mouse Edition with gruvbox colorscheme.
Description: Cascade, Mouse Edition, is a Firefox Style based on the Cascade theme by Andreas Grafen
What you get is a really simple one-line layout using the new Proton UI.
The original Cascade Theme by Andreas Grafen was based on SimpleFox :
> SimpleFox: https://github.com/migueravila/SimpleFox
Authors: Andreas Grafen (original cascade theme)

Công nghệ tổng hợp tiếng nói, thường được gọi là chuyển văn bản thành tiếng nói, đã phát triển nhanh chóng trong những năm qua. Tuy nhiên, để xây dựng một hệ thống tổng hợp giọng nói của một người cần chi phí rất lớn. Voice cloning là một kĩ thuật giải quyết vấn đề trên, có thể tổng hợp tiếng nói của một người bất kỳ chỉ với 5 - 10 câu thu âm giọng người đó.

Nhóm đã tìm hiểu và tái hiện lại một công trình nghiên cứu về Voice Cloning. Để ứng dụng mô hình, nhóm đã xây dựng một hệ thống web cho người dùng tổng hợp văn bản, cụ thể là truyện cổ tích để đọc cho trẻ em. Qua dự án này, nhóm đã tìm hiểu được cách cấu trúc một dự án AI cũng như cách tương tác với mô

@ziap
ziap / vec.h
Last active November 12, 2022 02:25
Simple C++ dynamic array implementation
#include <cstdlib>
#include <cstring>
template <typename T> class vec {
private:
static constexpr size_t INIT_CAP = 1;
size_t cap;
size_t count;
T *data;
@ziap
ziap / gradient.py
Last active November 20, 2022 09:48
Python script for generating a smooth, dithered gradient
from PIL import Image, ImageColor
import numpy as np
from numba import njit
dist = np.array([
[1, 0, 7],
[-1, 1, 3],
[0, 1, 5],
[1, 1, 1]
])
@ziap
ziap / sum.cpp
Last active December 8, 2022 13:04
WebAssembly dynamic memory
#define export extern "C" __attribute__((visibility("default")))
using u8 = char;
using u32 = unsigned;
using i32 = int;
using u64 = unsigned long long;
#define PAGE 16384
#define PAGE_FULL 65536
@ziap
ziap / rebuild.hpp
Last active December 18, 2022 07:45
Automatically recompile c++ file when the source changes
#include <cstdlib>
#include <filesystem>
#ifndef LAST_BUILD
#define LAST_BUILD 0
#endif
// USAGE:
// ```cpp
// int main(int argc, char** argv) {
@ziap
ziap / list.h
Last active March 22, 2023 01:05
Simple but unsafe dynamic array for C
#ifndef LIST_H
#define LIST_H
#include <stdlib.h>
#include <string.h>
typedef struct {
size_t length;
size_t capacity;
} list_header_t;
@ziap
ziap / README.md
Last active May 4, 2023 15:17
MiniRand - Portable rust random number generator

MiniRand

Small, portable random number generator for Rust

Usage

let mut rng = Rand::new(/* seed */);

let x = rng.rand(); // random float between 0 and 1