Skip to content

Instantly share code, notes, and snippets.

View kentkost's full-sized avatar
Sleep deprived

Kent Kostelac kentkost

Sleep deprived
View GitHub Profile
/*
* Example of a singleton design pattern.
* Copyright (C) 2011 Radek Pazdera
* 2018, uzername. No memory leak; assignment and copy operators are hidden from public access.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@kentkost
kentkost / bash_profile.sh
Last active June 24, 2019 08:55
Jenkinsfile Linter for my bash_profile
# add ~/.bash_profile if needed for executing ~/.bashrc
if [ -e ~/.bashrc -a ! -e ~/.bash_profile -a ! -e ~/.bash_login -a ! -e ~/.profile ]; then
printf "\n\033[31mWARNING: Found ~/.bashrc but no ~/.bash_profile, ~/.bash_login or ~/.profile.\033[m\n\n"
echo "This looks like an incorrect setup."
echo "A ~/.bash_profile that loads ~/.bashrc will be created for you."
cat >~/.bash_profile <<-\EOF
# generated by Git for Windows
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc
EOF
@kentkost
kentkost / datatypeToBinary.cpp
Last active April 6, 2018 12:51
Universal datatype to binary representation #binary
#include <iostream>
#include <string>
#include <bitset>
#include <sstream>
#include <array>
using byte = unsigned char; //Char is the smallest possible datatype. hence the reason for using it
std::bitset<8> charToBits(byte b);
template<typename T> std::bitset<sizeof(T)*8> toBinary(const T& object);