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
from subprocess import * | |
import time | |
def validate(sequence): | |
start = time.clock() | |
sorter = Popen('sort1mb.exe', stdin=PIPE, stdout=PIPE, stderr=PIPE) | |
for value in sequence: | |
sorter.stdin.write('%08d\n' % value) | |
sorter.stdin.close() | |
result = [int(line) for line in sorter.stdout] |
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 <mintomic/mintomic.h> | |
#include <time.h> | |
struct Message | |
{ | |
clock_t tick; | |
const char* str; | |
void* param; | |
}; |
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
#! /usr/bin/env python | |
# License: http://creativecommons.org/publicdomain/zero/1.0/ | |
# See http://preshing.com/20130115/view-your-filesystem-history-using-python | |
import optparse | |
import os | |
import fnmatch | |
import time | |
# Parse options | |
parser = optparse.OptionParser(usage='Usage: %prog [options] path [path2 ...]') |
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
#-------------------------------------------------------------- | |
# MathJax tags for Octopress | |
# | |
# Put this in the plugins folder. | |
# Use a single "inlinemath" tag for inline math. | |
# Use a pair of "math/endmath" tags for math as a standalone paragraph. | |
# The "math" tag takes an optional size argument. | |
# You also need to include MathJax in the page header, for example by adding | |
# <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> | |
# to source/_includes/custom/head.html |
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
#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 <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
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 <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
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}}) { |
OlderNewer