Skip to content

Instantly share code, notes, and snippets.

@PaulChana
PaulChana / NormalDistribution.cpp
Last active August 29, 2015 14:23
C++11 Normal distribution random numbers
#include <random>
std::mt19937 generator;
double mean = 0.0;
double std = 1.0;
std::normal_distribution<double> normal(mean, std);
const double normalNumber = normal(generator);
@PaulChana
PaulChana / LineStartsWith.sh
Last active August 29, 2015 14:23
Get lines starting with a string in bash
grep "^String_to_find" "myfile.txt"
# example:
# grep "^Bugfix:" "~/myfile.txt"
# Finds and returns all lines that start with Bugfix:
@PaulChana
PaulChana / GitCommitMessages.sh
Last active August 29, 2015 14:23
Git commit messages since tag
git log --pretty=format:%s <LAST_RELEASE>..HEAD
@PaulChana
PaulChana / LastTag.sh
Last active August 29, 2015 14:23
Last tag on git branch
git describe --abbrev=0 --tag
@PaulChana
PaulChana / NM.sh
Last active August 29, 2015 14:23
Print binary symbols
nm "PATH TO EXE" > "OUTFILE.txt"
@PaulChana
PaulChana / TerminalTextColour.sh
Last active August 29, 2015 14:23
Colourize text in terminal
function printError
{
# Number after setaf is the colour...
# 0 - black
# 1 - red
# 2 - green
# 3 - yellow
# 4 - blue
# 5 - magenta
# 6 - cyan
@PaulChana
PaulChana / ResartPrefsServer.sh
Last active June 6, 2017 08:42
Restart OSX preferences server (forces reload of prefs on app start)
killall cfprefsd