Skip to content

Instantly share code, notes, and snippets.

View AregevDev's full-sized avatar
😀

Alon Regev AregevDev

😀
  • Rehovot, Israel
View GitHub Profile
@AregevDev
AregevDev / vector.rs
Created August 12, 2023 11:54
A generic Vector3 struct for whenever I need it
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign};
use num_traits::{Float, Num, NumAssignOps};
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd)]
pub struct Vector3<T: Num + Copy> {
pub x: T,
pub y: T,
pub z: T,
}
@AregevDev
AregevDev / simple_app.dart
Created April 30, 2020 15:50
Flutter Stuff
import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';
void main() => runApp(MyApp());
class RandomWords extends StatefulWidget {
@override
RandomWordsState createState() => RandomWordsState();
}
@AregevDev
AregevDev / inc.comp
Created March 5, 2020 22:55
Dummy Vulkan compute application
#version 450 core
layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
layout (set = 0, binding = 5, std430) buffer MyBuffer
{
uint array[];
} myBuffer;
layout (push_constant) uniform Scalar
@AregevDev
AregevDev / Shader.hpp
Last active November 7, 2019 15:24
Pls review
//
// Created by AregevDev on 11/5/2019.
//
#pragma once
#include <glad/glad.h>
#include <sstream>
#include <fstream>
@AregevDev
AregevDev / glbug.cpp
Last active August 20, 2019 19:46
No normal matrix, just output the normals
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#include <glad/glad.h>
#define STB_IMAGE_IMPLEMENTATION
#include <stb/stb_image.h>
#define NK_INCLUDE_FIXED_TYPES
#include <math.h>
#include <raylib/raymath.h>
#include <raylib/raylib.h>
int main() {
InitWindow(500, 500, "Hello World");
SetTargetFPS(60);
Vector2 player = {30.0f, 70.0f};
@AregevDev
AregevDev / readfile.c
Created July 17, 2019 18:59
Function for reading files
char *readFile(const char *filepath) {
char *source = NULL;
FILE *fp = fopen(filepath, "r");
if (fp) {
if (fseek(fp, 0L, SEEK_END) == 0) {
long bufsize = ftell(fp);
source = malloc(sizeof(char) * (bufsize + 1));
fseek(fp, 0L, SEEK_SET);
size_t len = fread(source, sizeof(char), bufsize, fp);
use oauth2::reqwest::http_client;
use oauth2::{basic::BasicClient, AuthUrl, AuthorizationCode, ClientId, ClientSecret, CsrfToken, Scope, TokenUrl, TokenResponse};
use std::io::{BufRead, BufReader, Write};
use std::net::TcpListener;
use url::Url;
use serenity::http::Http;
fn main() {
let client = BasicClient::new(
ClientId::new("544523578855391241".to_string()),
use glium::glutin::{
dpi::LogicalSize, Api, ContextBuilder, Event, EventsLoop, GlRequest, WindowBuilder, WindowEvent,
};
use glium::index::{NoIndices, PrimitiveType};
use glium::texture::RawImage2d;
use glium::{implement_vertex, uniform, Display, DrawParameters, Program, Surface, VertexBuffer};
use image::GenericImageView;
use std::io::Cursor;
use glium::uniforms::{Sampler, MagnifySamplerFilter};