Skip to content

Instantly share code, notes, and snippets.

View shreyasbharath's full-sized avatar

Shreyas Balakrishna shreyasbharath

View GitHub Profile
@shreyasbharath
shreyasbharath / hexdump.cpp
Last active October 1, 2024 11:04
Hexdump - C++ version of XXD style hexdump (based on this StackOverflow answer https://stackoverflow.com/a/7776146/801008)
#include <iomanip>
#include <iostream>
#include <vector>
#include <termcolor.hpp>
void HexDump(const std::vector<uint8_t>& bytes, std::ostream& stream)
{
char buff[17];
size_t i = 0;
@shreyasbharath
shreyasbharath / fs_vs_db.rb
Last active December 20, 2017 22:21
FileSystem vs Database
require 'benchmark/ips'
require 'daybreak'
require 'dbm'
require 'fileutils'
require 'sqlite3_hash'
require 'xxhash'
class DaybreakDb
def initialize(db_file)
@db_file = db_file
@shreyasbharath
shreyasbharath / settings
Last active March 28, 2018 02:11
Cmder config
# name: Ctrl-D exits
# type: bool
# Ctrl-D exits the process when it is pressed on an empty line.
ctrld_exits = 1
# name: Ctrl-C raises exception
# type: bool
# When Ctrl-C is pressed Clink will pass it thourgh to the parent by raising the
# appropriate exception.
passthrough_ctrlc = 1
@shreyasbharath
shreyasbharath / .block
Created March 29, 2018 06:41
Graph comparison
license: mit
@shreyasbharath
shreyasbharath / .block
Created March 30, 2018 05:39
Selections: Data example
license: mit
@shreyasbharath
shreyasbharath / BSP code
Created November 6, 2019 21:51
ESP32 RTC WDT API
void bsp_rtc_wdt_enable(uint32_t time_ms)
{
rtc_wdt_protect_off();
rtc_wdt_disable();
rtc_wdt_set_length_of_reset_signal(RTC_WDT_SYS_RESET_SIG, RTC_WDT_LENGTH_3_2us);
rtc_wdt_set_stage(RTC_WDT_STAGE0, RTC_WDT_STAGE_ACTION_RESET_RTC);
rtc_wdt_set_time(RTC_WDT_STAGE0, 150000, time_ms); // Running off internal RC oscillator at 150 KHz
rtc_wdt_enable();
rtc_wdt_protect_on();
}