Skip to content

Instantly share code, notes, and snippets.

View skmp's full-sized avatar

Stefanos Kornilios Mitsis Poiitidis skmp

View GitHub Profile
@skmp
skmp / test.cpp
Created September 28, 2023 06:28
libclang template arguments via python
template<int x, int y>
void DoSomething() {
// consume x, y as constants
}
void foo() {
DoSomething<0,1>();
DoSomething<640,480>();
// ./a.out | aplay -r 256000 ?
#include <stdio.h>
#include <stdint.h>
#include <x86intrin.h>
#include <atomic>
#include <unistd.h>
#include <math.h>
std::atomic<uint8_t> caches[128 * 512 * 64];
@skmp
skmp / alloc.cpp
Created August 12, 2022 00:33
Grab address space
// $ gcc alloc.cpp -Wl,-esteal -static -g -fno-stack-protector
//
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/syscall.h>
#include <cerrno>
#include <cstdint>
@skmp
skmp / copyable-functions.cpp
Created June 23, 2022 11:07
Copyable Functions v2
// Example of creating function specializations at run time from a "canonical" template provided by the compiler
// More details: https://github.com/FEX-Emu/fex-assorted-tests-bins/tree/main/src/copyable-functions
#include <cstdint>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <tuple>
@skmp
skmp / a-test.cpp
Last active June 10, 2022 09:48
copyable functions
//More details: https://github.com/FEX-Emu/fex-assorted-tests-bins/tree/main/src/copyable-functions
#include <cstdint>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <sys/mman.h>
// Example of creating function specializations at run time from a "canonical" template provided by the compiler
@skmp
skmp / hls_testbench.cpp
Created March 12, 2021 14:54
FPPAdc: HLS testbench
#include "refrend_hls.h"
#include <stdio.h>
using namespace std;
int main()
{
int err =0;
@skmp
skmp / refrend_hls.cpp
Last active March 12, 2021 14:33
FPGAdc: Getting started w/ HLS
/*******************************************************************************
What if you generated a PowerVR CLX2 ISP and TSP implementation with HLS?
Would it fit to the ultra96?
*******************************************************************************/
#include <cmath>
#include <algorithm>
#include <memory.h>
@skmp
skmp / recover-labels.rb
Last active June 14, 2019 18:35
Used to recover reicast/reicast-emulator labels after the repo loss from the issue event stream
# Used to recover reicast/reicast-emulator labels after the repo loss
# The labels were missing, however the event stream was fine for each issue
# Uses octokit
require 'set'
require 'json'
require 'net/http'
require 'octokit'
client = Octokit::Client.new(:access_token => '<a personal access token>')
@skmp
skmp / reicast-cla-v1.md
Last active July 27, 2017 22:45
Reicast CLA v1

Individual Contributor License Agreement

Thank you for your interest in Reicast, created by Stefanos Kornilios Mitsis Poiitidis (the "Owner"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Owner must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Owner and its users; it does not change your rights to use your own Contributions for any other purpose. Please read this document carefully before signing and keep a copy for your records.

You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the Owner. Except for the license granted herein to the Owner and recipients of software distributed by the Owner, You reserve all right, title, and interest in and to Your Contributions.

  1. Definitions.

"You" (or

$.ajax("https://raw.githubusercontent.com/reicast/reicast-emulator/master/core/emitter/generated_descriptors.h").then(function(a) {
var instructions = a.replace(/\,\n/g,"").replace(/\n/g,"").replace(/\,OP/g,"OP").split("s_LIST_END");
instructions = _.map(instructions, function(a) {
return _.chain(a.split("OP"))
.filter( function(a) { return a != ""})
.map(function(a) { return a.slice(1, -1).split(/(?!\([^),]*),(?![^(]*\))/); })
.map(function(a) { return _.object(["name", "bytes", "enc_param", "enc_imm", "byte_count", "param_1", "param_2", "param_3","opsz"],a) })
.map(function(a) { a.bytes = _(a.bytes.match(/0x[0-9a-f]*/ig)).map(function(a) { return parseInt(a); }); return a; }).value();