Skip to content

Instantly share code, notes, and snippets.

View pcolby's full-sized avatar

Paul Colby pcolby

View GitHub Profile
@pcolby
pcolby / bootstrap
Created June 5, 2015 04:34
Bootstrapping out-of-source builds
#!/bin/bash
declare -A CC CXX SPEC
CC=( [clang]=clang [gcc]=gcc )
CXX=( [clang]=clang++ [gcc]=g++ )
SPEC=( [clang]=clang [gcc]=g++ )
SOURCE_DIR=`pwd`
TOPDIR=~/tmp/build
@pcolby
pcolby / ! Bootstrap.md
Last active August 29, 2015 14:17
Bootstrapping new OSes

TODO

eg

# sudo yum install git || sudo apt-get install git
git clone https://gist.github.com/9ca8b78f57ed5af5e40d.git bootstrap
pushd bootstrap
bash './Bootstrap ....sh'
popd
@pcolby
pcolby / ! XPS 13.md
Last active August 24, 2017 19:50
XPS 13 9343

Just some notes on my XPS 13 (9343) setup.

See also mpalourdio/xps13.

DP-1
  -> DP-1-1
    -> DP-1-1-1: Dell 2007FPB (Left)  [eVGA DP3]
    -> DP-1-1-2: Dell 2007FPB (Right) [eVGA DP2]
 -> DP-1-2: Dell U3014 (Middle) [eVGA DP1]
@pcolby
pcolby / Badges.sh
Last active August 29, 2015 14:00
#!/bin/bash
if [ $# -lt 2 ]; then
echo "Usage: `basename $0 .sh` github-username github-project-name" >&2
exit 1
fi
# @brief Generate Markdown.
# @param $1 Image alt text.
# @param $2 Image URL.
@pcolby
pcolby / init_rpm.sh
Created December 3, 2013 22:53
Initialise RPM build environment
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
@pcolby
pcolby / install-aws-php-sdk.sh
Created October 6, 2013 07:24
Near-trivial notes on how to install the official AWS PHP SDK on RHEL-based boxes.
sudo yum install php php-pear
sudo pear channel-discover guzzlephp.org/pear
sudo pear channel-discover pear.amazonwebservices.com
sudo pear channel-discover pear.symfony.com
sudo pear install aws/sdk
@pcolby
pcolby / xmlToVariant.cpp
Last active December 28, 2022 19:44
Sample function for parsing a QXmlStreamReader (or part thereof) to a QVariant tree.
QVariantMap xmlStreamToVariant(QXmlStreamReader &xml, const QString &prefix = QLatin1String("."), const int maxDepth = 1024)
{
if (maxDepth < 0) {
qWarning() << QObject::tr("max depth exceeded");
return QVariantMap();
}
if (xml.hasError()) {
qWarning() << xml.errorString();
return QVariantMap();
@pcolby
pcolby / cpu.sh
Created September 14, 2013 04:29
Calculating CPU Usage from /proc/stat
#!/bin/bash
# by Paul Colby (http://colby.id.au), no rights reserved ;)
PREV_TOTAL=0
PREV_IDLE=0
while true; do
CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics.
unset CPU[0] # Discard the "cpu" prefix.
IDLE=${CPU[4]} # Get the idle CPU time.