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
# If not running interactively, don't do anything | |
[[ $- != *i* ]] && return | |
# set -x | |
KEYTIMEOUT=1 | |
HISTFILE=~/.zsh_history | |
HISTSIZE=1000000 | |
SAVEHIST=1000000 | |
setopt EXTENDED_HISTORY | |
setopt PROMPT_SUBST |
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
//# lazy_static = "1.4.0" | |
#![allow(dead_code, unused_variables)] | |
#![feature(scoped_threads)] | |
#![feature(negative_impls)] | |
use std::rc::Rc; | |
use std::sync::Arc; | |
struct T; |
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
//# actix = "0.13.0" | |
//# tokio = { version = "1.17.0", features = ["net"] } | |
//# tokio-util = { version = "0.7.1", features = ["codec"] } | |
//# bytes = "1.1.0" | |
use actix::prelude::*; | |
use std::net::SocketAddr; | |
use tokio::net::{ | |
tcp::{OwnedReadHalf, OwnedWriteHalf}, |
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
main: main.c | |
gcc main.c $(shell pkg-config --cflags --libs libsgx_epid) -o main |
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
// [dependencies] | |
// jwt = { version = "0.14.0", features = ["openssl"] } | |
// openssl = "0.10.32" | |
// serde_json = "1" | |
// Docs: | |
// https://developers.google.com/identity/protocols/oauth2/service-account | |
use openssl::pkey::{PKey, Private}; |
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
FROM ubuntu:latest | |
WORKDIR /root | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN apt-get clean | |
RUN apt-get update | |
RUN apt-get upgrade -y | |
# install misc prerequisites | |
RUN apt-get install -y git | |
RUN apt-get install -y curl |
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
#![allow(unused_macros)] | |
#![allow(clippy::inconsistent_digit_grouping)] | |
macro_rules! bitpack_internal { | |
($type:ty; []; ) => { | |
(0 as $type, 0) | |
}; | |
($type:ty; [$num:literal]; $arg:expr) => {{ | |
let (mut val, mut width) = bitpack_internal!($type; []; ); | |
val |= $arg & (1 as $type).checked_shl($num).unwrap_or(0).wrapping_sub(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
use core::cell::UnsafeCell; | |
use core::sync::atomic::{fence, spin_loop_hint, AtomicBool, Ordering}; | |
struct SpinlockMutex<T> { | |
locked: AtomicBool, | |
data: UnsafeCell<T>, | |
} | |
struct SpinlockMutexGuard<'mtx, T> { | |
mutex: &'mtx SpinlockMutex<T>, | |
} | |
impl<T> SpinlockMutex<T> { |
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
$ ../install/bin/ruby ../test.rb | |
push / pop: | |
user system total real | |
Deque push 0.006660 0.000000 0.006660 ( 0.006663) | |
Array push 0.007511 0.000000 0.007511 ( 0.007562) | |
Deque pop 0.005977 0.000034 0.006011 ( 0.006018) | |
Array pop 0.006018 0.000000 0.006018 ( 0.006022) | |
Deque push (and write) 0.010819 0.000078 0.010897 ( 0.010912) | |
Array push (and write) 0.010133 0.000000 0.010133 ( 0.010138) |
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 <bits/stdc++.h> | |
struct Range { | |
// [l, r) | |
int l; | |
int r; | |
Range() : l(-1), r(-1) {} | |
Range(int l, int r) : l(l), r(r) { fit(); } | |
void fit() { |
NewerOlder