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 <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 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 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 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, | |
} |
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
package main | |
import ( | |
"bytes" | |
"fmt" | |
"github.com/eclipse/paho.mqtt.golang/packets" | |
) | |
func main() { | |
connectPkt := bytes.NewBuffer([]byte{ |
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
// ID for the parameter | |
type ParamId<T> = T; | |
type ParamKey<Component> = Component extends `:${infer NameWithPattern}` | |
? `param_${ParamId<NameWithPattern>}` | |
: never; | |
type ParamKeys<Path> = Path extends `${infer Component}/${infer Rest}` | |
? ParamKey<Component> | ParamKeys<Rest> | |
: ParamKey<Path>; |
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
# Pull data from SAM.gov, extract all attachments, push to S3 storage | |
import subprocess | |
import json | |
import os | |
from pathlib import Path | |
from multiprocessing import Pool | |
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 | |
#nsys profile -w true -t cuda,nvtx,osrt,cudnn,cublas -s none -o nsight_prof.bin -f true -x true python3 test.py | |
nsys profile -w true -t cuda,nvtx,osrt,cudnn,cublas -s none \ | |
-o nsight_prof.bin \ | |
--capture-range=cudaProfilerApi \ | |
--cudabacktrace=true \ | |
-f true \ | |
-x true \ | |
python3 test.py |
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
SYSTEM: Transcript of conversation between HUMAN and ASSISTANT. ASSISTANT can respond to USER with structured JSON messages. | |
USER: Extract information from an email as a JSON object matching the following TypeScript interface | |
```typescript | |
interface DeliveryInformation { | |
/* Tracking number for the delivery */ | |
tracking_number: string; | |
/* Status of the delivery, one of "preparing", "out-for-delivery", or "delivered" */ | |
status: string; | |
/* Weight of the package, e.g. "2oz" or "3lb" */ | |
weight: string; |
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
// Silly little XCode Playground for experimenting with the Secure Enclave programming. | |
// See more at https://developer.apple.com/videos/play/wwdc2019/709 | |
// and also sample code at https://developer.apple.com/documentation/cryptokit/performing_common_cryptographic_operations | |
import UIKit | |
import CryptoKit | |
import LocalAuthentication | |
// Get access to secure enclave |