Skip to content

Instantly share code, notes, and snippets.

View StackTrace.cpp
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,
View gist:2d58c41b95e592bbfd8db9ca6dbd5027
#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
View StackTrace.cpp
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.
View tumblrtagcloud.js
// Taken from:
var postcount = 0;
var postmax = 400;
var posttotal = 0;
var tmap = new Object();
var tvals = new Object();
var vstr = "";
var tdiv = document.getElementById("tagcloud");
tdiv.innerHTML = "Loading cloud...";
kennyyu /
Created Jun 12, 2014
script to count the number of lines written by an author in a git repository
import argparse
import json
import os
import subprocess
class Chdir:
Initializer/destructor pattern for cd taken from here:
kennyyu / .gitignore
Created Feb 2, 2014
cs161 gitignore file
View .gitignore
# ignore eclipse metadata files
kennyyu / sys161.conf
Created Jan 22, 2014
2013 sys161.conf for ASST1
View sys161.conf
# 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
kennyyu / ASST1
Created Jan 22, 2014
2013 ASST1 config
View ASST1
# 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
kennyyu /
Created Sep 20, 2013
edit N random files
if [ -z "$1" ]
echo "usage: $0 N"
exit 1
files=$(find /home/passifist/linux-2.4.29 | grep "\.[ch]")