Skip to content

Instantly share code, notes, and snippets.

View igormorgado's full-sized avatar
🙃

Igor Morgado igormorgado

🙃
View GitHub Profile
@igormorgado
igormorgado / tmux.conf
Created July 1, 2017 22:09 — forked from petrhosek/tmux.conf
Irssi Tmux integration
new-window -n irssi irssi
split-window -h -p15 -t0 ‘/bin/cat ~/.irssi/nicklistfifo’
send-keys -t1 "tmux send-keys -t0 \"irssi\" C-m; \
tmux send-keys -t0 \"/set nicklist_height \$(stty size | cut -f1 -d' ' -)\" C-m; \
tmux send-keys -t0 \"/set nicklist_width \$(stty size | cut -f2 -d' ' -)\" C-m; \
tmux send-keys -t0 \"/nicklist fifo\" C-m; \
cat ~/.irssi/nicklistfifo" C-m
select-pane -t
@igormorgado
igormorgado / tmux-notify.pl
Created July 1, 2017 22:11 — forked from basilfx/tmux-notify.pl
Irssi and tmux-notify
use strict;
use warnings;
use vars qw($VERSION %IRSSI);
use Irssi;
# Script info
$VERSION = '0.1';
%IRSSI = (
authors => 'Bas Stottelaar',
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkMenu" id="open_recent_menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<object class="GtkMenu" id="options_menu">
<property name="visible">True</property>
@igormorgado
igormorgado / A_readme
Last active October 16, 2019 01:29
Simple GObject usage.
How to use G_DECLARE_DERIVATIVE_TYPE and/or G_DECLARE_FINAL_TYPE in this code to reduce the "boilerplate code"?
Right now, errors building the code:
pet-dog.c: In function ‘pet_dog_print’:
pet-dog.c:17:36: error: invalid type argument of ‘->’ (have ‘PetBaseClass’ {aka ‘struct _PetBaseClass’})
PET_DOG_GET_CLASS(self)->parent->print(self);
^~
pet-dog.c: In function ‘pet_dog_class_init’:
pet-dog.c:86:27: warning: assignment to ‘void (*)(PetBase *)’ {aka ‘void (*)(struct _PetBase *)’} from incompatible pointer type ‘void (*)(PetDog *)’ {aka ‘void (*)(struct _PetDog *)’} [-Wincompatible-pointer-types]
#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
#include <stdint.h>
#include <glib.h>
#include <gmodule.h>
struct entity {
int32_t value; // 4 bytes
char name[12]; // 12 bytes
};
#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;
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);
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;
#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);