Skip to content

Instantly share code, notes, and snippets.

View igormorgado's full-sized avatar
🙃

Igor Morgado igormorgado

🙃
View GitHub Profile
@igormorgado
igormorgado / uvenv.fish
Created March 9, 2025 02:51
A fish function to manage UV powered virtualenvs
function uvenv --description "Creates or loads an uv virtual environment."
argparse 'p/python=' 'l/local' 'y/yes' 'h/help' -- $argv
or return 1
set env_file ".python-uversion"
# Handle help request
if set -q _flag_help
_uvenv_print_help $env_file
return 0
@igormorgado
igormorgado / lstmcell.tex
Last active November 23, 2022 13:49
LSTMCELL.tex
\documentclass[tikz]{standalone}
\usepackage{amsmath}
\usepackage{bm}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{backgrounds}
\usetikzlibrary{calc}
\usetikzlibrary{fit}
\usetikzlibrary{positioning}
#include <SDL2/SDL.h>
int main(void) {
SDL_Init(SDL_INIT_EVERYTHING);
SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt");
SDL_Window *window = SDL_CreateWindow("Controllers", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_SHOWN);
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
SDL_bool is_running = SDL_TRUE;
SDL_GameController *ctrl;
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
/*
*
* STRUCTS, Enums and Typedefs
*
*/
#include <SDL2/SDL.h>
void list_joysticks();
int main(void) {
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
int sdl_flags = SDL_INIT_JOYSTICK;
int is_running = 1;
SDL_Init(sdl_flags);
int dump_texture_to_file(SDL_Renderer *renderer, SDL_Texture *texture, const char *filename)
{
SDL_Log("%s: ENTERING\n", __func__);
Uint32 format = 0;
int access = 0;
int width = 0;
int height = 0;
int retval = 0;
void dump_texture_to_file(SDL_Renderer *renderer, SDL_Texture *texture, const char *filename)
{
SDL_Log("%s: ENTERING\n", __func__);
Uint32 format;
int access;
int width;
int height;
SDL_QueryTexture(texture, &format, &access, &width, &height);
#include <SDL2/SDL.h>
int main(void) {
SDL_bool quit = SDL_FALSE;
SDL_Init(SDL_INIT_VIDEO);
SDL_Window *window = SDL_CreateWindow("Mouse events", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_SHOWN);
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
SDL_SetRenderDrawColor(renderer, 127, 127, 127, 255);
SDL_RenderClear(renderer);
SDL_Event event;
#include <stdint.h>
#include <glib.h>
#include <gmodule.h>
struct entity {
int32_t value; // 4 bytes
char name[12]; // 12 bytes
};
#include <glib.h>
#include <glib/gi18n.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
typedef int32_t i32;
// A sample object data
struct data