Skip to content

Instantly share code, notes, and snippets.

View prabindh's full-sized avatar
💭
I may be slow to respond.

Prabindh Sundareson prabindh

💭
I may be slow to respond.
View GitHub Profile
// Test program to use nengl - displays fullscreen quad with single color
#define GLFW_INCLUDE_ES2 1
#include <GLFW/glfw3.h>
#include <stdio.h>
#include <string>
#include <vector>
#include "nengl_ws.h"
#include <stdio.h>
#include <stdlib.h>
#include <string>
#define GLFW_INCLUDE_ES2
#include <GLFW/glfw3.h>
static const GLuint WIDTH = 800;
static const GLuint HEIGHT = 600;
static const GLchar* vertex_shader_source =
@prabindh
prabindh / build-libangle.bat
Created July 1, 2020 13:04
libAngle build
https://github.com/google/angle/blob/master/doc/DevSetup.md
open cmd shell:
set PATH=<>\depot_tools;%PATH%
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
cd <>\angle
python scripts/bootstrap.py
gn gen out/Release
@prabindh
prabindh / cpuid.cpp
Created June 3, 2020 08:32
cpuid for avx avx2
//
// Derived https://stackoverflow.com/questions/1666093/cpuid-implementations-in-c
//
#include <iostream>
#include <string>
using namespace std;
#ifdef _WIN32
#include <limits.h>
@prabindh
prabindh / video-read-ffmpeg.cpp
Created May 8, 2020 04:03
Programmatic read video packet and decode using FFMPEG API
// Modified from https://gist.github.com/cedricve/a7f6817c18eeb19a0716ed0ca0e037c4
// Open the initial context variables that are needed
SwsContext *img_convert_ctx;
AVFormatContext* format_ctx = avformat_alloc_context();
AVCodecContext* codec_ctx = NULL;
int video_stream_index;
std::ofstream output_file;
int64_t last_time = 0, first_time= 0;
@prabindh
prabindh / audio-read-ffmpeg.cpp
Created May 8, 2020 04:01
Programmatic read Audio packets and decode from MP4
// Modified from - https://gist.github.com/cedricve/a7f6817c18eeb19a0716ed0ca0e037c4
// Open the initial context variables that are needed
SwsContext *img_convert_ctx;
AVFormatContext* format_ctx = avformat_alloc_context();
AVCodecContext* codec_ctx = NULL;
int audio_stream_index;
std::ofstream output_file;
int64_t last_time = 0, first_time = 0;
@prabindh
prabindh / ffmpeg-logging.cpp
Created May 8, 2020 03:58
Adding logging to FFMPEG
static void ffmpeg_avcodec_log(void *ptr, int val, const char * msg, va_list ap)
{
}
// As below, ffmpeg_avcodec_log_function()
av_log_set_callback(ffmpeg_avcodec_log_function);
@prabindh
prabindh / save_packet_to_disk
Created May 5, 2020 08:09 — forked from sunjun/save_packet_to_disk
save AVPacket from mem to disk and then read back
#include <libavutil/timestamp.h>
#include <libavformat/avformat.h>
static FILE *open_file_write(const char *file);
static FILE *open_file_read(const char *file);
static size_t write_packt_to_file(AVPacket *packet, FILE *file);
static size_t read_packt_from_file(AVPacket *packet, FILE *file);
static void close_file(FILE *file);
static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt, const char *tag)
#include <iostream>
#include <chrono>
#include <ctime>
int main() {
auto timenow = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
std::cout << "It sings at " << ctime(&timenow);
return 0;}
@prabindh
prabindh / log.txt
Created April 11, 2020 14:00
Log of cudf installation in colab - failure
using cudf instead of Pandas
(Add -y for conda install rapidsai channel as below, else it waits for input)
!wget -c https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh
!chmod +x Anaconda3-5.1.0-Linux-x86_64.sh
!bash ./Anaconda3-5.1.0-Linux-x86_64.sh -b -f -p /usr/local
!conda install -y -c rapidsai -c nvidia -c numba -c conda-forge \
cudf=0.13 python=3.6 cudatoolkit=10.1
import cudf