Skip to content

Instantly share code, notes, and snippets.

View 56phil's full-sized avatar

Phil Huffman 56phil

  • n/a
  • Kansas City, Missouri USA
  • 23:50 (UTC -05:00)
  • X @56prh56
View GitHub Profile
@56phil
56phil / mpW4d.cpp
Last active July 5, 2023 21:26
converts boost cpp_int, up 9*20^68, to words
// mpW4d.cpp
#ifndef MPW4D_CPP
#define MPW4D_CPP
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/fwd.hpp>
#include <string>
#include <vector>
struct aStruct {
@56phil
56phil / words4digits.cpp
Created July 4, 2023 18:32
convert positive long integers to words
// words4digits.cpp
#ifndef WORDS4DIGITS
#define WORDS4DIGITS
// in: unsigned long long (ull)
// out: string &
#include <string>
#include <vector>
@56phil
56phil / mpGroup.cpp
Created July 4, 2023 13:16
Group boost MP
// mpGroup.cpp
/*
* for digit grouping of boost cpp_int variables
*/
#ifndef MPGROUP
#define MPGROUP
#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>
@56phil
56phil / timestamp.cpp
Last active July 2, 2023 23:45
timestamp
// timestamp.cpp
#ifndef TIMESTAMP
#define TIMESTAMP
#include <sstream>
#include <string>
void timestamp(std::string &, bool = true, bool = true);
@56phil
56phil / gist:3889610
Created October 14, 2012 19:44
Latex: EQ Array
% brackets may be (...), [...], \{...\}, or left out
\[
\left[
\begin{array}{cc}
a & b \\
c & d
\end{array}
\right]
\]
@56phil
56phil / gist:3889514
Created October 14, 2012 19:06
Latex: EQ Split
\[
\begin{split}
a = {}& b + c \\
{}& + d + e \\
\end{split}
\]
@56phil
56phil / gist:3889503
Created October 14, 2012 19:02
Latex: EQ Align
% requires amsmath; align* for no eq. number
\begin{align}
x &= y + z \\
x &= y + z
\end{align}
@56phil
56phil / gist:3889470
Created October 14, 2012 18:53
Latex: Float Table
% Requires the booktabs if the memoir class is not being used
\begin{table}[htbp]
\centering
%\topcaption{Table captions are better up top} % requires the topcapt package
\begin{tabular}{@{} lcr @{}} % Column formatting, @{} suppresses leading/trailing space
\toprule
\multicolumn{2}{c}{Item} \\
\cmidrule(r){1-2} % Partial rule. (r) trims the line a little bit on the right; (l) & (lr) also possible
Animal & Description & Price (\$)\\
\midrule
@56phil
56phil / gist:3889463
Created October 14, 2012 18:51
Latex: Float Figure
\begin{figure}[htbp]
\centering
\includegraphics{example.jpg} % requires the graphicx package
\caption{example caption}
\label{fig:example}
\end{figure}
@56phil
56phil / gist:3889333
Created October 14, 2012 17:56
Latex: Template
\documentclass[12pt]{article}
\usepackage{amsmath,amssymb} % Better maths support & more symbols
\usepackage{array} % for better arrays (eg matrices) in maths
\usepackage{bm} % Define \bm{} to use bold math fonts
\usepackage{booktabs} % for much better looking tables
\usepackage{fancyhdr} % This should be set AFTER setting up the page geometry
\usepackage{flafter} % Don't place floats before their definition
\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
\usepackage{graphicx} % makes drawing easier
\usepackage{epstopdf} % graphics conversion