Skip to content

Instantly share code, notes, and snippets.

Oscar Kramer oscarkramer

  • KramerAnalytic
  • Miami Beach
Block or report user

Report or block oscarkramer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
oscarkramer / LongOptionsParse.cpp
Last active Dec 14, 2018
Long Option Parsing in C++
View LongOptionsParse.cpp
#include <getopt.h>
#include <iostream>
using namespace std;
void usage(const char* appName, int exitCode, string errMsg="")
if (!errMsg.empty())
oscarkramer /
Last active Jul 31, 2018
YAML to JSON File converter in python
# Converts input YAML file to JSON and writes the JSON to same filename but with ".json" ext.
import os, json, sys, yaml
if len(sys.argv) < 2:
print("Usage: "+sys.argv[0]+" <input.yaml>")
yamlFname = sys.argv[1]
pre, ext = os.path.splitext(yamlFname)
jsonFname = pre + ".json"
oscarkramer / printHorizontalLine
Created May 18, 2018
Bash script to output a horizontal line spanning the width of the terminal using dashes (or optional string provided)
View printHorizontalLine
# Usage: printHorizontalLine [c]
function printHorizontalLine {
local c="-"
local strlen=1
if [ -n "$1" ]; then
oscarkramer /
Last active May 18, 2018
Bash functions for prompting yes/no question
# Bash function to prompt terminal user for yes|no
# Author: Oscar Kramer
# If interactive shell, prompts user for confirmation considering optional default (Y|N) specified.
# The default is returned if <enter> is typed in lieu of a y|n character. The prompt is appended with
# " [Y|n]:" or " [y|N]:" depending on default provided.
# If not interactive, returns answerYes=1, answerNo=0
# Returns boolean
You can’t perform that action at this time.