Skip to content

Instantly share code, notes, and snippets.

View punitsoni's full-sized avatar
🚀
Happy Hacking!

Punit Soni punitsoni

🚀
Happy Hacking!
View GitHub Profile
@punitsoni
punitsoni / hello.c
Last active August 29, 2015 14:00
Test
#include <stdio.h>
int main()
{
printf("Hello, world.\n");
return 0;
}
@punitsoni
punitsoni / encoder.c
Created May 2, 2014 23:21
Quad-encoder monitoring code
#define ENC_INPUT_A 0
#define ENC_INPUT_B 1
#define ENC_INPUT_I 2
typedef struct enc_state {
int8_t idx, ab;
int8_t dir;
int32_t pos_count;
int32_t isr_count;
int8_t enc_error_flag;
@punitsoni
punitsoni / gitignore
Created May 10, 2015 00:44
Autotools gitignore
# http://www.gnu.org/software/automake
Makefile.in
# http://www.gnu.org/software/autoconf
/autom4te.cache
/aclocal.m4
/compile
/configure
@punitsoni
punitsoni / Dockerfile
Created May 11, 2017 07:17
punits-ubuntu-dockerfile
#
# image for ubuntu desktop interactive
#
FROM ubuntu:16.04
MAINTAINER "Punit Soni <[email protected]>"
# install basic packages
RUN apt-get update && \
apt-get install -y sudo vim git tmux
@punitsoni
punitsoni / README.md
Last active December 2, 2018 19:07
mjpeg_clock_server
@punitsoni
punitsoni / gpg-encrypt-api-keys.md
Last active October 3, 2024 15:22
gpg-encrypt-api-keys

How to use gpg to securely store your api keys

When you are using a third-party api in your application code. it usually requires you to supply some secret client information when making requests. if your code is opensource or accessible by a lot of people, putting these keys directly in code in plaintext can be a security issue.

One approach that i have seen in the wild is to use os environment variables to store the secrets and your app code can query the environment when starting up. this still requires someone to set up the environment in your server when

@punitsoni
punitsoni / vimrc
Last active August 12, 2020 21:49
A good default vimrc without plugins
" -- General Options #general -----------------------------------------------{{{
" ---------------------------------------------------------------------------- "
set nocompatible
" Syntax highlighing on
syntax on
" Highlight search term as you type
set hlsearch
" Show current command in statusbar
set showcmd
" Enable mouse