Skip to content

Instantly share code, notes, and snippets.

View astarasikov's full-sized avatar
🐈
🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈

Alexander Tarasikov astarasikov

🐈
🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈
View GitHub Profile
@astarasikov
astarasikov / backtrace.c
Created September 3, 2014 22:20
Backtrace in C for Linux/OS X
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <unwind.h>
#include <execinfo.h>
@astarasikov
astarasikov / vaapi_crap.c
Created May 6, 2014 15:20
first experiment at using vaapi
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <va/va.h>
#include <va/va_enc_h264.h>
#include <va/va_x11.h>
/*
* http://www.intel.cn/content/dam/www/public/us/en/documents/white-papers/atom-e6xx-video-encoding-paper.pdf
* This paper is crap. Since 2011 almost all VA API was changed
/*
Use the Makefile listed below and build with the PATH to your LLVM binaries
PATH=~/Documents/workspace/builds/llvm/build/bin/:$PATH make
#####
APPNAME=jit_tut1
LLFLAGS=$(shell llvm-config --cxxflags --ldflags --libs core jit interpreter x86) -lcurses
all:
c++ -g ./$(APPNAME).cpp $(LLFLAGS) -o ./$(APPNAME)
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <dlfcn.h>
#include <errno.h>
#include <stdio.h>
#include <signal.h>
#include <execinfo.h>
#include <ucontext.h>
#include <stdlib.h>
#include <sys/mman.h>
#define PAGE_SIZE 4096
#define PAGE_MASK (PAGE_SIZE - 1)
<html>
<script type="text/javascript">
function d2xy(n, d) {
var rx, ry, s, t, x, y;
t = d;
x = y = 0;
for (s = 1; s < n; s *= 2) {
rx = 1 & (t / 2);
@astarasikov
astarasikov / gist:7794123
Created December 4, 2013 19:38
minimalistic OpenGL window in Objective-C
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <CoreVideo/CVDisplayLink.h>
@interface SxgeView : NSOpenGLView <NSWindowDelegate>
-(void)registerDisplayLink;
-(void)renderForTime:(CVTimeStamp)time;
-(void)windowWillClose:(NSNotification*)note;
#include <iostream>
#include <cstdlib>
#include <pthread.h>
using namespace std;
#define LOOP_COUNT 30
#define NUM_THREADS 4
#define Q_SIZE 5
-module(midi).
-export([parse/1, parse_file/1]).
-define(BEINT, big-unsigned-integer-unit).
-define(BEBIT, 1/?BEINT:1).
-define(BEINT7, 1/?BEINT:7).
-define(BEINT16, 1/?BEINT:16).
-define(BEINT32, 1/?BEINT:32).
-define(MIDI_HEADER, 16#4d546864:?BEINT32).
# Generated by iptables-save v1.4.2 on Sun Mar 29 19:49:39 2009
*nat
:PREROUTING ACCEPT [612:120070]
:POSTROUTING ACCEPT [2011:162593]
:OUTPUT ACCEPT [2011:162593]
-A POSTROUTING -s 192.168.0.0/16 -o eth3 -j MASQUERADE
COMMIT
# Completed on Sun Mar 29 19:49:39 2009
# Generated by iptables-save v1.4.2 on Sun Mar 29 19:49:39 2009
*filter