Skip to content

Instantly share code, notes, and snippets.

View jyn514's full-sized avatar

jyn jyn514

View GitHub Profile
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `hexponent` crate."><meta name="keywords" content="rust, rustlang, rust-lang, hexponent"><title>hexponent - Rust</title><link rel="stylesheet" type="text/css" href="/normalize-20200726-1.47.0-nightly-6c8927b0c.css"><link rel="stylesheet" type="text/css" href="/rustdoc-20200726-1.47.0-nightly-6c8927b0c.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="/light-20200726-1.47.0-nightly-6c8927b0c.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="/dark-20200726-1.47.0-nightly-6c8927b0c.css" disabled ><link rel="stylesheet" type="text/css" href="/ayu-20200726-1.47.0-nightly-6c8927b0c.css" disabled ><script src="/storage-20200726-1.47.0-nightly-6c8927b0c.js"></script><noscript><link rel="stylesheet" href="/noscript-20200726-1.47.0-nightly-6c8927b0c.cs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"><meta content="width=device-width, initial-scale=1.0" name="viewport"><meta content="rustdoc" name="generator"><meta content="API documentation for the Rust `hexponent` crate." name="description"><meta content="rust, rustlang, rust-lang, hexponent" name="keywords"><title>hexponent - Rust</title><link href="/normalize-20200726-1.47.0-nightly-6c8927b0c.css" rel="stylesheet" type="text/css"><link href="/rustdoc-20200726-1.47.0-nightly-6c8927b0c.css" id="mainThemeStyle" rel="stylesheet" type="text/css"><link href="/light-20200726-1.47.0-nightly-6c8927b0c.css" id="themeStyle" rel="stylesheet" type="text/css"><link disabled="" href="/dark-20200726-1.47.0-nightly-6c8927b0c.css" rel="stylesheet" type="text/css"><link disabled="" href="/ayu-20200726-1.47.0-nightly-6c8927b0c.css" rel="stylesheet" type="text/css"><script src="/storage-20200726-1.47.0-nightly-6c8927b0c.js"></script><noscript><link rel="stylesheet" href="/noscript-20200726
Currently the behavior is as follows (where stageN <-> stage(N-1) artifacts, except for stage0 libstd):
- `x.py build --stage 0`:
- stage0 libstd
- stage0 rustc (but without putting rustc in stage1/)
This leaves you without any rustc at all except for the beta compiler
(https://github.com/rust-lang/rust/issues/73519). This is never what you want (currently you should use either `x.py check` or `x.py build --stage 0 src/libstd` instead).
- `x.py build --stage 1`:
5 KLPhash
5 a42-__-
5 aabb-quadtree
5 abci-rs
5 abort_on_panic
5 abra
5 absal
5 abstractgraph
5 aces
5 aci_ppm
@jyn514
jyn514 / build.sh
Created December 2, 2019 21:55
Shell script for building a rust crate using rustops/crates-build-env
#!/bin/sh
set -euv
#cargo check # make sure dependencies are installed
CONTAINER="$("docker" "create" \
"-v" "$(realpath ./target):/opt/rustwide/target:rw,Z" \
"-v" "$(realpath .):/opt/rustwide/workdir:ro,Z" \
"-v" ~/.cargo:/opt/rustwide/cargo-home:ro,Z \
"-v" ~/.rustup:/opt/rustwide/rustup-home:ro,Z \
@jyn514
jyn514 / literals-to-file.rs
Last active November 26, 2019 06:13
Convert a bunch of string literals to files. Used for https://github.com/jyn514/rcc/tree/external-tests
extern crate syn;
use syn::Expr;
use std::fs;
use std::path::Path;
const TARGET_DIR: &str = "runner-tests";
fn main() {
let mut args = std::env::args();
import re
import socket
import subprocess
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("ctfchallenges.ritsec.club", 8080))
data = s.recv(1024)
if data == "":
exit(1)
@jyn514
jyn514 / bench.txt
Last active November 5, 2019 14:09
docs.rs benchmarks
# summary
docs.rs is _much_ faster than my hard disk.
Adding concurrency reduces overall time but increases individual time
Most of the delay on current prod is due to network latency, not CPU time
I cannot reproduce the CPU usage locally - requests are just as fast or faster on the version that overloaded prod as on the latest version.
## extended timing info
### Current prod (I _believe_ c3d3ed3d2e0c4274c0c12a7b1f5e56e68eb8b8bf, remote)
@jyn514
jyn514 / fib.s
Created October 22, 2019 21:32
Fibonacci in MIPS assembly without a jump instruction
# fibonacci sequence in MIPS
# $s0 stores the next to last item in the sequence
# $s1 stores the last item in the sequence
# this is just for initialization
li $t0, 1 # F_1 (since F_0 is 0, we don't need to initialize the registers)
seq $t1, $s1, $0 # if s1 == 0 this is the first run
# conditional move: if (t1) s1 = t0
@jyn514
jyn514 / discrete.hs
Last active February 4, 2020 01:28
CLI helper for discrete math, but in haskell
import Prelude hiding (gcd, lcm)
import Data.Bits ((.&.), Bits)
import Data.Semigroup
import System.Exit (die)
import System.Environment (getProgName, getArgs)
import Text.Printf (printf)
-- | Calculate whether a number is odd
isOdd :: (Integral a, Data.Bits.Bits a) => a -> Bool
isOdd n = n .&. 1 == 1