Skip to content

Instantly share code, notes, and snippets.

@tyler-cromwell
tyler-cromwell / ispowerof.py
Created November 15, 2017 17:31
Test if a number is a power of a certain number (default: 2)
#!/usr/bin/env python3
import math
def is_power_of(n, b):
# Outside domain of logarithm
if n <= 0:
return False
# Determine power x to raise b to, to get n
@tyler-cromwell
tyler-cromwell / .vimrc
Created August 6, 2017 14:26
My .vimrc
autocmd BufEnter * colorscheme default
" Syntax Highlighting for Shell files
autocmd BufEnter *.sh colorscheme desert
" Syntax Highlighting for C files
autocmd BufEnter *.c colorscheme default
autocmd BufEnter *.h colorscheme default
" Syntax Highlighting for Java files
@tyler-cromwell
tyler-cromwell / Makefile
Last active August 19, 2017 01:37
Makefile for building/installing debug and release executables
CXX = g++
CXXFLAGS = -std=c++11 -pedantic -Wall -Wextra -march=native
DEBUGFLAGS = -O0 -ggdb3 -D DEBUG
RELEASEFLAGS = -O2
TARGET = test-cmd
SOURCES = $(shell find ./ -name *.cpp)
HEADERS = $(shell find ./ -name *.h)
OBJECTS = $(SOURCES:.cpp=.o)