Skip to content

Instantly share code, notes, and snippets.

View sailfish009's full-sized avatar

sailfish009

  • freelancer
  • South Korea
View GitHub Profile
@sailfish009
sailfish009 / Makefile
Created July 21, 2016 02:03 — forked from sehe/Makefile
Boost shared memory lockfree circular buffer queue
all:consumer producer
CPPFLAGS+=-std=c++03 -Wall -pedantic
CPPFLAGS+=-g -O0
CPPFLAGS+=-isystem ~/custom/boost/
LDFLAGS+=-L ~/custom/boost/stage/lib/ -Wl,-rpath,/home/sehe/custom/boost/stage/lib
LDFLAGS+=-lboost_system -lrt -lpthread
%:%.cpp
@sailfish009
sailfish009 / sdl2_opengl.cpp
Created September 20, 2016 06:38 — forked from sergnechaev/sdl2_opengl.cpp
Very basic SDL2 OpenGL application (C++1y)
#include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
constexpr int SCREEN_WIDTH = 800;
constexpr int SCREEN_HEIGHT = 600;
diff --git a/src/unix/internal.h b/src/unix/internal.h
index 03a9226..b2f1a41 100644
--- a/src/unix/internal.h
+++ b/src/unix/internal.h
@@ -86,7 +86,7 @@
#endif
#if defined(__linux__)
-# define UV__POLLIN UV__EPOLLIN
+# define UV__POLLIN (UV__EPOLLIN | UV__EPOLLPRI)
@sailfish009
sailfish009 / FreeType2_Mono.c
Created February 20, 2017 04:31 — forked from ironpinguin/FreeType2_Mono.c
Simple example to use FreeType for get a monochrome text output rendering. build linux: gcc -g -o freeTypeDemo FreeType2_Mono.c -I/usr/include/freetype2 -L/usr/lib/x86_64-linux-gnu -lz -lfreetype -lm
/* First test with FreeType2 library */
/* Output to console of mono rendered font */
/*
* FreeType2_Mono.c
*
* Created by Michele Catalano <michele@catalano.de>.
*
* Copyright (c) 2013 Michele Catalano
* All rights reserved.
*
/*
* V4L2 video capture example
*
* This program can be used and distributed without restrictions.
*
* This program is provided with the V4L2 API
* see http://linuxtv.org/docs.php for more information
*/
#include <stdio.h>
# Make sure you grab the latest version
curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip
# Unzip
unzip protoc-3.2.0-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
@sailfish009
sailfish009 / vlcsms.c
Created January 22, 2018 09:02 — forked from TimSC/vlcsms.c
Using libvlc to extract raw frames and audio from media via smem
//To compile:
//cc vlcsms.c -o vlcsms -lvlc
//This source is by Tim Sheerman-Chase and it is released as public domain.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <vlc/vlc.h>
/* USI SPI Slave Demo written by Robert Mollik, 2016
*
* This demo uses the SPI protocol with USI interface. This is necessary with with the smaller AVR controller since they don't
* a complete SPI functionality.
* Demo is written for the pinout of an Arduino Trinket and ATtiny85. Pins need to be modified if a different controller is used.
*
* The demo takes receives a request ID from the Master at the beginning of every communication. According to the request ID,
* it sends back either a temperature or a humidity values. Since both values are present in float, the 4 bytes of the float need
* to be send separately.
*/
/* SPI Master Demo written by Robert Mollik, 2016
*
* This demo uses the SPI protocol on a Arduino Uno R3 / ATmega8 controller
*
* The demo sends out a request ID depending, whether a temperature or humidity signal shall be obtained from the slave. Both signals
* are datatype float, however get received as 4 bytes and need to be re-assembled.
*/
#define CS PC0 // Chip select pin, any vacant portpin can be used
@sailfish009
sailfish009 / deferreddevice.h
Created February 27, 2018 02:53 — forked from zeux/deferreddevice.h
Implementing Direct3D for fun and profit
struct DeferredDirect3DDevice9: DummyDirect3DDevice9
{
private:
char* begin;
char* write;
char* read;
char* end;
enum command_t
{