Skip to content

Instantly share code, notes, and snippets.

View justintoo's full-sized avatar

Justin Too justintoo

View GitHub Profile
$ g++ test.cpp && ./a.out
Min = 5
Max = 77
Check if two numbers are equal without using arithmetic operators or comparison operators.
#include <iostream>
void F(int* A, int* B, int N) {
// B[i] = product of...
for (int i=0; i<N; ++i) {
int product = 1;
// ...all A[j], j!= i
for (int j=0; j<N; ++j) {
if (j == i) continue;
else {
#!/bin/bash
sudo apt-get update
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
#!/bin/bash -e
#-------------------------------------------------------------------------------
# Default values
#-------------------------------------------------------------------------------
: ${GCC_VERSION:=$1}
: ${GCC_LANGUAGES:=c,c++,fortran}
: ${MPFR_HOME:=}
: ${MPFR_VERSION:=}
: ${GMP_HOME:=}
#!/bin/bash -x
#-------------------------------------------------------------------------------
# Set defaults
#-------------------------------------------------------------------------------
: ${MPC_VERSION:=$1}
: ${MPFR_HOME:=}
: ${MPFR_VERSION:=}
: ${GMP_HOME:=}
: ${GMP_VERSION:=}
#!/bin/bash -e
#
# Usage: ./install-boost <version: x.xx.x>
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <version: 1.39.0>"
exit 1
fi
VERSION="$1"
@justintoo
justintoo / install-rose-llnl.sh
Created October 30, 2018 00:07
Quick and dirty ROSE installation script
#!/bin/bash
: ${DO_EVERYTHING:="yes"}
: ${DO_UPDATE:="no"}
: ${DO_BUILD:="no"}
: ${DO_RM_BUILD:="no"}
: ${DO_CONFIGURE:="no"}
: ${DO_MAKE:="no"}
: ${DO_INSTALL:="no"}
' Input Range: Select a cell reference
Sub HighlighJanuaryInColumn()
' Save the workbook before performing any actions so we can roll back by quitting without saving
ThisWorkbook.Save
On Error Resume Next
Set targetRange = Application.InputBox(prompt:="Select a range", Title:="Select First Date in Column", Type:=8)
If targetRange = False Then
MsgBox "Canceling Macro"
Exit Sub
# Install most things needed to compile ROSE
apt-get --assume-yes install \
git wget vim \
g++-4.8 gfortran-4.8 clang-3.5 \
libtool automake cmake flex bison \
default-jdk \
python3-dev \
doxygen graphviz-dev \
libqt4-dev qt4-dev-tools \
libgraphicsmagick-dev libreadline-dev libmagic-dev \