Skip to content

Instantly share code, notes, and snippets.

View deepikabhavnani's full-sized avatar

Deepika Bhavnani deepikabhavnani

View GitHub Profile

Update 7/28/2019: An updated version of this guide for Ubuntu Server 18.04 LTS is now available. Feel free to check it out.

Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

This guide will walk you through steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest. Tested on Ubuntu Server 16.04.3 LTS (Xenial Xerus)

Steps:

  1. Open VirtualBox
  2. Right-click your VM, then click Settings
  3. Go to Shared Folders section
@deepikabhavnani
deepikabhavnani / golang_trace_extract.py
Last active June 7, 2019 19:17
Script to map alloc/free calls from golang trace
# input is trace file obtained by executing your go binary with trace enabled
# tmp directory should be created by user
# GODEBUG=allocfreetrace=1 go_binary
# output file gives alloc/free collection in csv file - tmp/memory.csv
# allocs which didnt have matching free calls in - tmp/leftallocs.csv
import sys
allocStr = "tracealloc"
freeStr = "tracefree"
@deepikabhavnani
deepikabhavnani / malloc_example.cpp
Created March 6, 2019 04:40
malloc_example.cpp
#include "mbed.h"
void *array[1000];
int main()
{
void *data = NULL;
int count = 0;
int size = 100;
@deepikabhavnani
deepikabhavnani / CRC_example.cpp
Last active January 24, 2018 19:31
New CRC class example
#include "mbed.h"
#include "MbedCRC.h"
#include <iostream> // std::cout
#include <limits> // std::numeric_limits
int crc_sd_7bit() {
MbedCRC<POLY_7BIT_SD, 7> ct;
char test[6];
uint32_t crc;
@deepikabhavnani
deepikabhavnani / fat_testing.cpp
Created January 10, 2018 22:36
Temp_fat_testing
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@deepikabhavnani
deepikabhavnani / crc_test.cpp
Last active December 19, 2017 22:38
CRC _ Test
#include "mbed.h"
#include "mbed_crc.h"
#include "SlowCRC.h"
#include "FastCRC.h"
#include "HalfByteCRC.h"
#define FAST_COMPUTE 1
#if defined(FAST_COMPUTE)
#define CRC_TYPE FastCRC
@deepikabhavnani
deepikabhavnani / fat_seek_rewind.cpp
Created November 6, 2017 21:22
Issue: FAT Filesystem - Seek/rewind
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"
#include <stdlib.h>
#include <errno.h>
using namespace utest::v1;
// test configuration
@deepikabhavnani
deepikabhavnani / filesystem.cpp
Last active August 30, 2017 17:16
Filesystem Large Chunk Read/Writes
#include "mbed.h"
#include "FATFileSystem.h"
#include "SDBlockDevice.h"
#include <stdio.h>
#include <errno.h>
/* mbed_retarget.h is included after errno.h so symbols are mapped to
* consistent values for all toolchains */
#include "platform/mbed_retarget.h"
SDBlockDevice sd(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, MBED_CONF_SD_SPI_CS);
@deepikabhavnani
deepikabhavnani / thread_exit_sample
Created July 24, 2017 17:17
Thread Exit Hook Sample
#include "mbed.h"
static void on_thread_terminate(osThreadId_t id);
volatile int flag;
DigitalOut led1(LED2);
void blinky() {
while (flag) {
led1 = !led1;