This file contains hidden or 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
| """ | |
| A simple simulation of the Monty Hall problem | |
| """ | |
| import random | |
| ROUNDS = 100_000 | |
| WINS = 0 |
This file contains hidden or 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 pyarrow.parquet as pq | |
| import vortex as vx | |
| import numpy as np | |
| from time import time | |
| # taken from OpenAI text-3-small | |
| EMBED_DIM = 1536 | |
| N_EMBEDS = 1 |
This file contains hidden or 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
| pub fn pack_u8_u3(input: &[u8], packed: &mut [u8]) { | |
| // We have 1024 / size_of<T>() == 128 lanes to pull from. | |
| // Each lane accesses 1024 / T elements of data. | |
| const MASK: u8 = 0b111; | |
| const LANES: usize = 1024 / 8; | |
| for lane in 0..LANES { | |
| // First kernel: take in chunks of W values from the lane, and apply the same | |
| // operation. Being careful to shift off each time. | |
| let a = input[128 * 0 + lane] & MASK; | |
| let b = input[128 * 1 + lane] & MASK; |
This file contains hidden or 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
| macro_rules! make_encoding_ids_rec { | |
| ($count:expr) => {}; | |
| ($count:expr, $encoding:ident $($tts:tt)*) => { | |
| pub const $encoding: u16 = $count; | |
| make_encoding_ids_rec!(($count+1u16) $($tts)*); | |
| } | |
| } | |
| macro_rules! make_encoding_ids { | |
| ($($encodings:ident),*) => { |
This file contains hidden or 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
| /* SPDX-License-Identifier: MIT */ | |
| /* based on linux-kernel/tools/testing/selftests/net/msg_zerocopy.c */ | |
| /* gcc -luring -O2 -o send-zc ./send-zc.c */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <stdint.h> | |
| #include <assert.h> | |
| #include <errno.h> | |
| #include <error.h> | |
| #include <limits.h> |
This file contains hidden or 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 marimo | |
| __generated_with = "0.1.76" | |
| app = marimo.App() | |
| @app.cell | |
| def __(): | |
| from astropy.time import Time | |
| from astropy.coordinates import EarthLocation, get_sun, get_moon, AltAz |
This file contains hidden or 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 <stdlib.h> | |
| #include <arm_neon.h> | |
| #include <arm_acle.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| #include <assert.h> | |
| #include <sys/time.h> | |
| #include <time.h> | |
This file contains hidden or 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
| use std::hint::black_box; | |
| fn main() { | |
| // Leak the reference in a loop. | |
| println!("begin leaking memory"); | |
| for _ in 0..10 { | |
| let data = Box::new("hello world".to_string()); | |
| let _ = black_box(Box::leak(data)); // Needed to avoid allocs being optimized away by the compiler. | |
| } | |
| println!("done leaking memory"); |
This file contains hidden or 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
| #![feature(noop_waker)] | |
| #![feature(local_waker)] | |
| use std::collections::{HashMap, VecDeque}; | |
| use std::fmt; | |
| use std::fmt::Formatter; | |
| use std::future::Future; | |
| use std::marker::PhantomData; | |
| use std::pin::Pin; | |
| use std::ptr::null_mut; |
This file contains hidden or 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
| use std::fmt; | |
| use std::fmt::Formatter; | |
| use std::marker::PhantomPinned; | |
| use std::pin::{pin, Pin}; | |
| struct MyField { | |
| name: String, | |
| name_ptr: Option<*mut String>, | |
| __pinned: PhantomPinned, | |
| } |