Skip to content

Instantly share code, notes, and snippets.

View nnarain's full-sized avatar
🚀
Heya!

Natesh Narain nnarain

🚀
Heya!
View GitHub Profile
@nnarain
nnarain / ps1.txt
Created May 4, 2016 01:47
Bash Prompt PS1
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \[\033[01;33m\]\$(__git_ps1) \n~λ\[\033[00m\] "
@nnarain
nnarain / atom-setup.txt
Last active June 24, 2016 22:00
setup atom
Plugins
-------
minimap
todo-show
highlight-selected
minimap-highlight-selected
file-icons
open-recent
save-session
merge-conflicts
@nnarain
nnarain / AN3034.c
Last active May 31, 2016 12:05
HCS12 CAN Example from NXP App note
#include <hidef.h> /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
#define ST_ID_100 0x100
#define ACC_CODE_ID100 0x2000
#define ACC_CODE_ID100_HIGH ((ACC_CODE_ID100 & 0xFF00)>>8)
#define ACC_CODE_ID100_LOW (ACC_CODE_ID100 & 0x00FF)
/* Mask Code Definitions */
#include <hidef.h> /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
#include "can.h"
void canInit(void);
void main(void)
{
unsigned char errorflag;
unsigned char txbuff[] = "abcd";
@nnarain
nnarain / install.bash
Last active October 29, 2018 19:58
setup virtual can bus linux
#!/bin/bash
# install can-utils
git clone https://github.com/linux-can/can-utils.git
cd can-utils
./autogen.sh
./configure
make
sudo make install
@nnarain
nnarain / geneticalgorithm1.py
Last active July 9, 2016 23:00
Implementation of genetic algorithm to solve problem presented here: http://www.ai-junkie.com/ga/intro/gat3.html
#
# Genetic algorithm example from http://www.ai-junkie.com/ga/intro/gat1.html
#
# @author Natesh Narain
# @date July 9 2016
# Rule are encoded in the genes
# Long string of genes make up chromosomes
# Solution must have a way of being encoded into a chromosome
@nnarain
nnarain / gitbump.py
Last active July 12, 2016 15:31
git bump script
#
# Script to bump version number in a git repo
#
# @author Natesh Narain <[email protected]>
#
import subprocess
from argparse import ArgumentParser
import os
@nnarain
nnarain / gitcheatsheet.md
Last active October 15, 2016 18:07
Git cheatsheet

Git Cheat Sheet

Getting a remote branch without merging

git fetch origin my-branch

Aliasing Commands

@nnarain
nnarain / version-config.cmake
Last active October 15, 2016 16:26
Generate project metadata using cmake
# Generate version.h using data from git repository
#
# @author Natesh Narain
# @date Oct 15 2016
#
find_package(Git)
function(generate_version_info)
@nnarain
nnarain / pathfinding.cpp
Created February 25, 2017 06:31
OpenCV Triangulation
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <cmath>
#include <opencv2/opencv.hpp>