- A
secret
byte you want to read is stored at inaccessible memory locationpriv_mem
. - The sender triggers an access exception by attempting to access
priv_mem
. - Due to out-of-order execution, the load of
secret
and its access in step 4 may happen before the exception fires. - Calculate an
offset
into a known arrayprobe
by multiplyingsecret
by the width of a cache line. - This forces the cache to load
probe[offset]
, caching exactly one chunk of our array. - The exception fires, clearing the modified registers, but cached data is not excised.
- Iterate over all 256 offsets into
probe
to find out which one loads fast. You've determined the value ofsecret
.
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 ruby | |
# This script can be used to parse and dump the information from | |
# the 'html/contact_info.htm' file in a Facebook user data ZIP download. | |
# | |
# It dumps all cell phone call + SMS message + MMS records, plus a summary of each. | |
# | |
# Place this script inside the extracted Facebook data download folder | |
# alongside the 'html' folder. | |
# |
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 React from 'react' | |
function Login({onSubmit}) { | |
return ( | |
<div> | |
<form | |
data-test="login-form" | |
onSubmit={e => { | |
e.preventDefault() | |
const {username, password} = e.target.elements |
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
addEventListener('fetch', event => { | |
event.respondWith(fetchAndCheckPassword(event.request)) | |
}) | |
async function fetchAndCheckPassword(req) { | |
if (req.method == "POST") { | |
try { | |
const post = await req.formData(); | |
const pwd = post.get('password') | |
const enc = new TextEncoder("utf-8").encode(pwd) |
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
-- Haskell will match starting at the top, until it hits a catchall | |
factorial :: Int -> Int | |
factorial 0 = 1 | |
factorial n = n * factorial(n - 1) | |
-- Haskell is able to match empty lists and x:xs patterns | |
head' :: [a] -> a | |
head' [] = error "No head available on empty lists!" | |
head' (x:_) = x |
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
type product = { | |
category: string, | |
price: string, | |
stocked: bool, | |
name: string | |
}; | |
type products = list(product); | |
let products = [ |
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
{ | |
"name": "<Your App Name Here />", | |
"reason": { | |
"react-jsx": 2 | |
}, | |
"bsc-flags": ["-bs-super-errors"], | |
"bs-dependencies": ["reason-react"], | |
"sources": [ | |
{ | |
"dir": "./src", |
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
var scores = [1, 4, 6, 8]; | |
var result = scores.reduce((total, score) => total + score) / scores.length; | |
console.log(result); // 4.75 |
// https://hackernoon.com/redux-flow-type-getting-the-maximum-benefit-from-the-fewest-key-strokes-5c006c54ec87
// https://github.com/facebook/flow/issues/4002
// eslint-disable-next-line no-unused-vars
type _ExtractReturn<B, F: (...args: any[]) => B> = B;
export type ExtractReturn = _ExtractReturn<*, F>;
Some links to point people to when they misinterpret PATENTS clause or spread false claims.
https://code.facebook.com/license-faq
https://wptavern.com/automattic-will-continue-to-use-react-js-in-calypso-despite-patent-clause