Skip to content

Instantly share code, notes, and snippets.

View lnikon's full-sized avatar

Vahag Bejanyan lnikon

View GitHub Profile
@kbendick
kbendick / mergesort.cpp
Created March 8, 2016 19:44
Implementation of merge sort in c++
// Declare/initialize any useful variables here, including the temporary array
// to merge values into and then copy back into the parameter array.
/*
while the temporary array is not filled
if there are no more values in the left part of a,
move next value from right part of a into next index of the temporary array otherwise, if there are no more values in the right part of a,
move next value from left part of a into next index of the temporary array otherwise (values in each part) compare the first value in each part
move smallest value from a into next index of the temporary array
@mhitza
mhitza / Makefile
Last active May 27, 2024 21:59
Programming Arduino Uno (ATmega386P) in assembly
%.hex: %.asm
avra -fI $<
rm *.eep.hex *.obj *.cof
all: $(patsubst %.asm,%.hex,$(wildcard *.asm))
upload: ${program}.hex
avrdude -c arduino -p m328p -P /dev/arduino-uno -b 115200 -U flash:w:$<
monitor:
@gboeer
gboeer / gist:1231475
Created September 21, 2011 07:33
C++ String Tokenizer
#include <string>
#include <vector>
//! Tokenize the given string str with given delimiter. If no delimiter is given whitespace is used.
void Tokenize(const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters = " ")
{
tokens.clear();
// Skip delimiters at beginning.
std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
// Find first "non-delimiter".