This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <limits> | |
namespace Detail | |
{ | |
double constexpr sqrtNewtonRaphson(double x, double curr, double prev) | |
{ | |
return curr == prev | |
? curr | |
: sqrtNewtonRaphson(x, 0.5 * (curr + x / curr), curr); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e; | |
BASE_DIRECTORY="$(cd "$(dirname "$0")"&&pwd)" | |
SSH_SOCKET="${BASE_DIRECTORY}"/%r.%h.%p.ssh_socket | |
SSH_HOST=localhost | |
#Exit ssh master connection when the script exits or is killed. | |
trap "ssh -q -o ControlMaster=no -o ControlPath=${SSH_SOCKET} -O exit ${SSH_HOST};" SIGINT SIGTERM EXIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A stack, using bash arrays. | |
# --------------------------------------------------------------------------- | |
# Create a new stack. | |
# | |
# Usage: stack_new name | |
# | |
# Example: stack_new x | |
function stack_new | |
{ |