Skip to content

Instantly share code, notes, and snippets.

View sailfish009's full-sized avatar

sailfish009

  • freelancer
  • South Korea
View GitHub Profile
/*
* 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 / hint.txt
Last active August 30, 2017 01:44
directshow application link error
add:LIBCMTD.lib under the setting->linker->input->Ignore specific library->LIBCMTD.lib
@sailfish009
sailfish009 / MainDlg.h
Created August 30, 2017 02:40
WTL head include to make MainDlg.cpp
// WTL cpp
////////////////////////////////////////////////////////////////////////////////////////
#include <atlframe.h>
#include <atlsplit.h>
#include <atlctrls.h>
#include <atlctrlw.h>
#include <atlctrlx.h>
#include <atlddx.h>
#include "resource.h"
@sailfish009
sailfish009 / popcnt.c
Created September 15, 2017 01:32
popcnt for old cpu
int popcnt(unsigned int v)
{
v = v - ((v >> 1) & 0x55555555); // reuse input as temporary
v = (v & 0x33333333) + ((v >> 2) & 0x33333333); // temp
return (((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24); // count
}
@sailfish009
sailfish009 / rpath
Created September 18, 2017 09:54
rpath usage
g++ -L/my/dir/path/ -Wl,-rpath=/my/dir/path/ -l:foo.so -l:bar.so
@sailfish009
sailfish009 / Makefile.APP
Created September 19, 2017 11:08
Simple Makefile for Application
TARGET ?= a.out
SRC_DIRS ?= ./src
INC_DIRS ?= ./include
SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s)
OBJS := $(addsuffix .o,$(basename $(SRCS)))
DEPS := $(OBJS:.o=.d)
LDLIBS := -Wl,-rpath=/foo/lib/ -l:libbar.so -L/usr/lib -lstdc++ -L./lib -lbar
@sailfish009
sailfish009 / Makefile.LIB
Created September 19, 2017 11:10
Simple Makefile for Library
TARGET ?= libbar.so
SRC_DIRS ?= ./src
INC_DIRS ?= ./include
SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s)
OBJS := $(addsuffix .o,$(basename $(SRCS)))
DEPS := $(OBJS:.o=.d)
LDLIBS := -L/usr/lib -lstdc++ -lm -shared -Wl,-soname,$(TARGET)
@sailfish009
sailfish009 / nds32_printf
Created September 22, 2017 02:57
NDS32 printf assembly
la $r2, 0x98C40000
li $r1, 0x38
swi $r1, [$r2]
# 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/
https://wiki.videolan.org/Win32Compile/
## some hints:
git clone https://git.code.sf.net/p/mingw-w64/mingw-w64
sudo cp -a ./mingw-w64/mingw-w64-headers/include/* /usr/i686-w64-mingw32/include/
../configure --host=i686-w64-mingw32 --build=x86_64-linux-gnu --disable-chromecast # protoc compiler version error