Skip to content

Instantly share code, notes, and snippets.

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

Alexander Tarasikov astarasikov

🐈
🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈
View GitHub Profile
#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)
/*
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)
@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
@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>
let rec revZipWithDefault accum dval lsta lstb =
match lsta with
| ha :: ta ->
(match lstb with
| hb :: tb -> zipWithDefault ((ha, hb) :: accum) dval ta tb
| _ -> zipWithDefault ((ha, dval) :: accum) dval ta [])
| _ ->
(match lstb with
| hd :: tl -> zipWithDefault ((dval, hd) :: accum) dval [] tl
| _ -> accum);;
@astarasikov
astarasikov / parse_math
Created February 19, 2015 23:20
some stupid expression parser, just a backup
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
enum token_type {
#!/usr/bin/env ruby
require 'Digest'
if 2 != ARGV.length then
puts "Usage: $0 dir [good_dir]"
exit -1
end
def probe_file(path, good_path)
#!/usr/bin/env ruby
require 'Digest'
require 'set'
if 0 == ARGV.length then
puts "Usage: $0 dir"
exit -1
end
#!/bin/bash
set -e
set -u
export SRC_LLVM="https://github.com/llvm-mirror/llvm.git"
export SRC_COMPILER_RT="https://github.com/llvm-mirror/compiler-rt.git"
export SRC_CLANG="https://github.com/llvm-mirror/clang.git"
export SRC_CLANG_EXTRA="https://github.com/llvm-mirror/clang-tools-extra.git"
export SRC_LIBCXX="https://github.com/llvm-mirror/libcxx.git"
@astarasikov
astarasikov / elf_dependency_graph.rb
Last active August 29, 2015 14:21
Visualize ELF dependency graph in Graphviz dot
#!/usr/bin/env ruby2.1
#@bin_dir="/home/me/bin/foo"
@bin_dir = ""
# context = {
# :exports => {
# "foo" => [
# "file2.ois",
# "file3.ois",