Skip to content

Instantly share code, notes, and snippets.

View sailfish009's full-sized avatar

sailfish009

  • freelancer
  • South Korea
View GitHub Profile
@sailfish009
sailfish009 / c2nasm.bash
Created March 21, 2019 05:47 — forked from abcdabcd987/c2nasm.bash
C to NASM Assembly
#!/bin/bash
# thanks to http://stackoverflow.com/a/20743090
# thanks to https://github.com/diogovk/c2nasm
# install objconv: https://github.com/vertis/objconv
#
# $1: source code
set -e
C_FILE="$1"
BASE_NAME="${C_FILE%.*}"
@sailfish009
sailfish009 / richhickey.md
Created April 18, 2018 03:25 — forked from prakhar1989/richhickey.md
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

@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
{
/* 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
/* 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.
*/
@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>
# 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/
/*
* 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>
@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 <[email protected]>.
*
* Copyright (c) 2013 Michele Catalano
* All rights reserved.
*
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)