Skip to content

Instantly share code, notes, and snippets.

View shiv50084's full-sized avatar

shiv50084

  • India
View GitHub Profile
@shiv50084
shiv50084 / kiosk.md
Created April 4, 2022 07:50 — forked from anthonyray/kiosk.md
Turn your Raspberry Pi into a kiosk playing looping videos

An acquaintance needed a video kiosk that plays looping videos for an exposition booth. Since I have a bunch of Raspberry Pis lying around, I figured that it would be the perfect use case for using one of them.

Let's assume we start from scratch, with a unflashed, brand new SD card and your Raspberry Pi.

Installing the OS

Install a version of Raspbian that includes the desktop. You can head over to : https://www.raspberrypi.org/downloads/raspbian/ and follow the instructions.

Once the image is downloaded, you can burn it to your SD card with tools like Etcher (https://www.balena.io/etcher/)

@shiv50084
shiv50084 / The Technical Interview Cheat Sheet.md
Created May 15, 2021 15:19 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

/*
A Minimal Capture Program
This program opens an audio interface for capture, configures it for
stereo, 16 bit, 44.1kHz, interleaved conventional read/write
access. Then its reads a chunk of random data from it, and exits. It
isn't meant to be a real program.
From on Paul David's tutorial : http://equalarea.com/paul/alsa-audio.html

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

@shiv50084
shiv50084 / recursive_load_dir.c
Created December 10, 2020 17:13 — forked from ajithbh/recursive_load_dir.c
Recursive load files in directory
#include <dirent.h>
int LoadFilesFromDir(char *pDirectory)
{
struct dirent *pDirEnt;
DIR *pDir = opendir(pDirectory);
if (pDir != NULL) {
while ((pDirEnt = readdir(pDir))) {
char *file = NULL;
char Buffer[512];
@shiv50084
shiv50084 / build_cross_gcc
Created December 4, 2020 16:06 — forked from preshing/build_cross_gcc
A shell script to download packages for, configure, build and install a GCC cross-compiler.
#! /bin/bash
set -e
trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
trap 'echo FAILED COMMAND: $previous_command' EXIT
#-------------------------------------------------------------------------------------------
# This script will download packages for, configure, build and install a GCC cross-compiler.
# Customize the variables (INSTALL_PATH, TARGET, etc.) to your liking before running.
# If you get an error and need to resume the script from some point in the middle,
# just delete/comment the preceding lines before running it again.
@shiv50084
shiv50084 / base64.c
Created September 27, 2020 12:04 — forked from svagionitis/base64.c
Base 64 encoding/decoding https://en.wikipedia.org/wiki/Base64
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TRUE 1
#define FALSE 0
/*The index Base64 table.*/
static const unsigned char indexBase64Tbl[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/*
(Easy): Sum-the-Digits, Part II (http://www.reddit.com/r/dailyprogrammer/comments/1fnutb/06413_challenge_128_easy_sumthedigits_part_ii/)
------------------------------------------------------------------------------------------------------------------------------------------
Given a well-formed (non-empty, fully valid) string of digits, let the integer N be the sum of digits. Then, given this integer N, turn it into a string of digits. Repeat this process until you only have one digit left. Simple, clean, and easy: focus on writing this as cleanly as possible in your preferred programming language.
`Author: nint22. This challenge is particularly easy, so don't worry about looking for crazy corner-cases or weird exceptions. This challenge is as up-front as it gets :-) Good luck, have fun!`
Formal Inputs & Outputs
-----------------------
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void usage(char *argv0);
unsigned char isPrime(unsigned long num);
int main(int argc, char *argv[])
{
unsigned long input = 0, result = 0;