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/bash | |
set -e | |
trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG | |
trap 'echo FAILED COMMAND: $previous_command' EXIT | |
#------------------------------------------------------------------------------------------- | |
# This script will download packages for, configure, build and install a GCC cross-compiler. | |
# Customize the variables (INSTALL_PATH, TARGET, etc.) to your liking before running. | |
# If you get an error and need to resume the script from some point in the middle, | |
# just delete/comment the preceding lines before running it again. |
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
// | |
// Generate benchmarks for the three queue implementations shown in | |
// Jeff Preshing's CppCon 2014 talk, "How Ubisoft Montreal Develops Games for | |
// Multicore - Before and After C++11". | |
// | |
// Slides: https://github.com/CppCon/CppCon2014/blob/master/Presentations/How%20Ubisoft%20Montreal%20Develops%20Games%20for%20Multicore/How%20Ubisoft%20Montreal%20Develops%20Games%20for%20Multicore%20-%20Before%20and%20After%20C++11%20-%20Jeff%20Preshing%20-%20CppCon%202014.pdf?raw=true | |
// | |
#include <iostream> | |
#include <atomic> |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
typedef unsigned int u32; | |
typedef unsigned long long u64; | |
//------------------------------------------------------------------------- | |
// WorkArea | |
//------------------------------------------------------------------------- |
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
// AutoSplit script for Manifold Garden 1.0.30.13294 | |
// | |
// Automatically starts the timer ~2.4 seconds after starting a new game, and splits the timer | |
// when transitioning between game levels. You must still reset the timer manually between runs. | |
// If you accidentally backtrack through a portal, causing an unwanted split, you'll have | |
// to undo it manually (default NumPad8 in LiveSplit). | |
// | |
// To compensate for the late start, you should delay your start timer by 2.4 seconds in LiveSplit. | |
// (Right-click -> Edit Splits -> Start timer at:) | |
// |
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
Results of a few quick tests performed in response to: | |
https://twitter.com/Steven_Pigeon/status/1121900020746338305 | |
// This is the original version that HAS the bug (garbage value encountered during iteration): | |
for (const AxisRay& faceRelVedge : std::initializer_list<AxisRay>{ | |
{{0, 0, -1}, Axis3::YNeg}, | |
{{0, 1, 0}, Axis3::ZPos}, | |
{{-2, -1, 0}, Axis3::ZPos}, | |
{{-1, -1, -1}, Axis3::XPos}}) { |
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 <iostream> | |
class Foo { | |
public: | |
void bar() { | |
std::cout << "Foo::bar() called" << std::endl; | |
} | |
}; | |
class Foo2 { |
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
import datetime | |
import re | |
import os | |
badTimeStamp = datetime.datetime.strptime("2010-03-08 15:02:59 -0500", "%Y-%m-%d %H:%M:%S %z") | |
desiredTimeStamp = datetime.datetime.strptime("2017-08-28 11:15:59 -0400", "%Y-%m-%d %H:%M:%S %z") | |
delta = desiredTimeStamp - badTimeStamp | |
for line in open("../backup.log", "r"): | |
m = re.match("r(\\d+) \\| jeff \\| (.*) \(", line) |
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 <atomic> | |
class SpinLock { | |
std::atomic<int> m_flag = 0; | |
public: | |
void lock() { | |
int expected = 0; | |
while (!m_flag.compare_exchange_weak(expected, 1, std::memory_order_acquire)) { | |
expected = 0; |
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 "randomsequence.h" | |
#include <stdio.h> | |
#include <string.h> | |
extern "C" | |
{ | |
#include "unif01.h" | |
#include "bbattery.h" | |
#include "util.h" | |
} |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
typedef unsigned int u32; | |
typedef unsigned long long u64; | |
//------------------------------------------------------------------------- | |
// WorkArea | |
//------------------------------------------------------------------------- |
NewerOlder