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
// Prabindh Sundareson 2020
// Age of the lockdown
#include "pch.h" // include #include "httplib.h" in this file
#include <iostream>
static httplib::Server svr;
void pressSpace()
{
@prabindh
prabindh / main.py
Last active April 10, 2020 02:26
Station-side Python code
import network
import urequests
import ujson
import machine
import time
def do_post(url, data):
headers = {'Content-Type': 'application/json'}
@prabindh
prabindh / pc-server.py
Created April 10, 2020 02:20
Server side Py application
from http.server import HTTPServer, BaseHTTPRequestHandler
from io import BytesIO
import os
import json
from pyautogui import press
def do_POST(self):
press('space')
# Standard respnse sequence headers fill here
#!/bin/bash
MULT="100"
NIGHTLIES=14
STABLE=13
LOWEST=11
RAPIDS_VERSION="0.$STABLE"
RAPIDS_RESULT=$STABLE
@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
#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 / 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)
@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 / 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 / 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;