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 random | |
from collections import deque | |
from dataclasses import dataclass | |
# Key is hour number | |
# 0 == midnight | |
# 1 == 1am, etc. | |
NUM_PATIENTS_PER_HOUR = { | |
4: 2, | |
5: 11, |
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
diff --git a/folly/folly/experimental/coro/Task.h b/folly/folly/experimental/coro/Task.h | |
--- a/folly/folly/experimental/coro/Task.h | |
+++ b/folly/folly/experimental/coro/Task.h | |
@@ -43,13 +43,37 @@ | |
#include <folly/futures/Future.h> | |
#include <folly/io/async/Request.h> | |
#include <folly/lang/Assume.h> | |
+#include <folly/synchronization/SanitizeThread.h> | |
#include <folly/tracing/AsyncStack.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
#!/bin/bash -ex | |
CONTENTS=$(cat <<EOF | |
foo | |
bar | |
baz | |
EOF | |
) | |
sudo echo "$CONTENTS" > /tmp/my_file.txt |
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 python3 | |
import argparse | |
import base64 | |
import json | |
import random | |
import sys | |
from typing import Dict, List, NamedTuple, Optional, Tuple | |
def exp(n: int, e: int, mod: Optional[int] = None) -> int: |
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 python3 | |
import base64 | |
import random | |
def exp(n, e, mod=None): | |
""" | |
Returns n^e (mod base if specified) | |
""" | |
result = 1 |
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
namespace { | |
// Helper struct for manually walking the stack using stack frame pointers | |
struct StackFrame { | |
StackFrame* parentFrame; | |
void* returnAddress; | |
}; | |
size_t walkNormalStack( | |
uintptr_t* addresses, | |
size_t maxAddresses, |
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
ssize_t getAsyncStackTraceSafe(uintptr_t* addresses, size_t maxAddresses) { | |
size_t numFrames = 0; | |
const auto* asyncStackRoot = tryGetCurrentAsyncStackRoot(); | |
if (asyncStackRoot == nullptr) { | |
// No async operation in progress | |
return numFrames; | |
} | |
// Start by walking the normal stack until we get to the frame right before | |
// the frame that holds the async root. |
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 <folly/executors/CPUThreadPoolExecutor.h> | |
#include <folly/experimental/coro/BlockingWait.h> | |
#include <folly/experimental/coro/Task.h> | |
#include <folly/init/Init.h> | |
#include <folly/synchronization/Baton.h> | |
#include <glog/logging.h> | |
namespace { | |
// Disallow inlining of the functions below so that we can see the functions |
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
# Sample sys161.conf file | |
# | |
# This file tells System/161 what devices to use. | |
# | |
# There are 32 LAMEbus slots on the System/161 motherboard. There may | |
# be only one bus controller card, and it must go in slot 31. Other | |
# than that, you can put in whatever devices you want. | |
# | |
# The syntax is simple: one slot per line; the slot number goes first, | |
# then the expansion card name, then any arguments. Some of the devices |
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
# Kernel config file for assignment 1. | |
include conf/conf.kern # get definitions of available options | |
debug # Compile with debug info. | |
# | |
# Device drivers for hardware. | |
# | |
device lamebus0 # System/161 main bus |
NewerOlder