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
sim.exe: top.v sim.cpp | |
verilator --cc --coverage --exe -Wno-lint -trace --top-module top \ | |
--Mdir bench_dir $^ | |
$(MAKE) -C bench_dir -f Vtop.mk | |
cp bench_dir/Vtop $@ | |
clean: | |
rm -f bench_dir sim.exe | |
.PHONY: clean |
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
// Extracted from Linux 4.0 by running `cd drivers/lguest && make Beer`. | |
// Pasted with syntax highlighting to make life easier. | |
{==- Preparation -==} | |
[ arch/x86/lguest/boot.c ] | |
/* | |
* A hypervisor allows multiple Operating Systems to run on a single machine. | |
* To quote David Wheeler: "Any problem in computer science can be solved with | |
* another layer of indirection." | |
* |
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
/* | |
Example usage (in configuration.nix): | |
services.phabricator.enable = true; | |
services.phabricator.baseURI = "secure.example.org"; | |
services.phabricator.baseFilesURI = "secure-files.example.org"; | |
services.phabricator.extensions = | |
{ libphutil-scrypt = "git://github.com/haskell-infra/libphutil-scrypt.git"; | |
libphutil-yubikey = "git://github.com/thoughtpolice/libphutil-yubikey.git"; |
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
{-# LANGUAGE ExistentialQuantification, RankNTypes #-} | |
{-# LANGUAGE InstanceSigs #-} | |
module CoYoneda where | |
import Data.IORef | |
import Data.Set (Set, map) | |
import Control.Monad (liftM) | |
-------------------------------------------------------------------------------- | |
-- Yoneda |
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
with import <nixpkgs> {}; | |
let | |
nextpnr-gui = pkgs.nextpnr; # gui by default on upstream | |
nextpnr-nogui = pkgs.nextpnr.override { enableGui = false; }; | |
common-pkgs = with pkgs; [ | |
symbiyosys yosys verilog verilator | |
icestorm trellis | |
z3 yices boolector |
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
let | |
# Wrap a nginx server block in an HTTPS site | |
wrapSSL = site: cert: key: block: '' | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name ${site}; | |
location /nginx_status { | |
stub_status on; |
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 bash | |
[ -z "$1" ] && echo "ERROR: must provide arg" && exit 1 | |
CACHE_URL=${CACHE_URL:-"https://cache.nixos.org"} | |
curl -v \ | |
-HFastly-Debug:1 \ | |
-o /dev/null 2>&1 \ | |
"$CACHE_URL/$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
#include "chacha20.h" | |
static unsigned int | |
L32(unsigned int x,unsigned int n) | |
{ | |
/* See: http://blog.regehr.org/archives/1063 */ | |
return (x<<n) | (x>>(-n&31)); | |
} | |
static unsigned 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
/** Snipped from pthread_machdep.h */ | |
#define __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY4 94 | |
extern __inline__ void * | |
_pthread_getspecific_direct(unsigned long slot) { |
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
{ | |
"AWSTemplateFormatVersion" : "2010-09-09", | |
"Description" : "FoundationDB CloudFormation Test. **WARNING** This template creates one or more Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", | |
"Parameters" : { | |
"InstanceType" : { | |
"Description" : "EC2 instance type", | |
"Type" : "String", | |
"Default" : "m1.large", |