Skip to content

Instantly share code, notes, and snippets.

View ashutoshbsathe's full-sized avatar
💭
Exploring

Ashutosh Sathe ashutoshbsathe

💭
Exploring
View GitHub Profile
@ashutoshbsathe
ashutoshbsathe / gist:648ebb2d7c8655f192bf0c8b05258492
Created August 28, 2017 05:02
Reference code for the DSA Discussion Forum on Moodle
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int main() {
int fd1, fd2;
char a[16] = "ABCDEFGHIJKLMNOP", ch;
fd1 = open("test1", O_RDWR | O_CREAT, 0666);
write(fd1, a, sizeof(a));
close(fd1); //closing and opening fd1 will reset the file handle to start of the file
fd1 = open("test1", O_RDWR, 0666);
@ashutoshbsathe
ashutoshbsathe / css.md
Created August 29, 2017 15:55 — forked from ptomato/css.md
GTK CSS properties
@ashutoshbsathe
ashutoshbsathe / infix-evaluator.c
Last active September 5, 2017 08:49
infix to postfix converter with postfix evaluator
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
@ashutoshbsathe
ashutoshbsathe / queue.c
Created October 6, 2017 04:00
Queue using structures and pointers (For Moodle Discussion Forum)
#include "queue.h"
#include <stdlib.h>
/*
* In queue.h
* Queue is defined as
* typedef struct queue {
* node *head;
* node *tail;
* node *tmp;
* } queue;
@ashutoshbsathe
ashutoshbsathe / imagenet-val-set.md
Last active July 5, 2020 14:48
Generating ground truth labels for ImageNet LSVRC 2012 Validation Set downloaded from AcademicTorrents

Ground Truth Labels for ImageNet LSVRC2012 Validation Set

Originally these labels were available at ImageNet website. The website now returns invalid page. Moreover, downloading the original data from ImageNet website is painfully slow. Downloading the validation set from AcademicTorrents is fast enough for everyone's need.

The only pain is that you don't get original labels from ImageNet website.

Fortunately, we can solve this using following piece of python code:

@ashutoshbsathe
ashutoshbsathe / download_videos_from_table.py
Created August 4, 2022 06:14
Downloading videos from a table in a directory. Uses `bs4` for parsing html, `requests` for download and `tqdm` for progressbar
# Author : Ashutosh Sathe (2019)
from bs4 import BeautifulSoup
from tqdm import tqdm
import os
import requests
fname = 'table.html'
dl_prefix = 'https://archive.nptel.ac.in'
title_idx = -2 # Second last cell text should be title of the downloaded video
dl_link_idx = -1 # Last cell contains the href to the video