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::{ | |
io::{self, Read, Write}, | |
net::{TcpListener, TcpStream}, | |
os::fd::{AsRawFd, RawFd}, | |
thread, | |
}; | |
const READ: libc::c_short = libc::POLLRDNORM; | |
const WRITE: libc::c_short = libc::POLLWRNORM; |
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
set -g default-terminal "screen-256color" | |
set -g terminal-overrides 'xterm*:smcup@:rmcup@' | |
set-option -sa terminal-overrides ",xterm*:Tc" | |
set -s escape-time 10 | |
setw -g xterm-keys on | |
set -g mouse on | |
setw -g mode-keys vi | |
unbind -n -Tcopy-mode-vi MouseDragEnd1Pane | |
set -g base-index 1 |
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 { | |
any, | |
char, | |
delimited, | |
int, | |
many0, | |
map, | |
multispace0, | |
nat, | |
parse, |
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
require "set" | |
class Sig | |
def initialize(&computation) | |
@observers = Set.new | |
@dependencies = Set.new | |
@computation = computation || proc { nil } | |
compute if block_given? | |
end |
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::ops::{Div, Sub}; | |
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] | |
pub enum Month { | |
Jan = 1, | |
Feb = 2, | |
Mar = 3, | |
Apr = 4, | |
Mai = 5, | |
Jun = 6, |
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::any::{Any, TypeId}; | |
use std::collections::HashMap; | |
#[derive(Default)] | |
pub struct AnyMap { | |
map: HashMap<TypeId, Box<dyn Any>>, | |
} | |
impl AnyMap { | |
pub fn insert<T: 'static>(&mut self, t: T) { |
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::mem; | |
#[derive(Debug, PartialEq)] | |
pub enum List<T> { | |
Empty, | |
Cons(T, Box<List<T>>), | |
} | |
impl<T> List<T> { | |
pub fn new() -> Self { |
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
async function* promisesIter(promises) { | |
promises = [...promises]; | |
const buffer = []; | |
for (promise of promises) { | |
promise.then(result => { | |
promises.splice(promises.indexOf(promise), 1); | |
buffer.push(result); | |
}); | |
} | |
while (promises.length === 0 || await Promise.race(promises).then(() => true)) { |
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::io::Write; | |
use std::net::TcpListener; | |
use std::thread::sleep; | |
use std::time::Duration; | |
fn main() -> std::io::Result<()> { | |
let port = std::env::var("PORT").unwrap_or("3000".into()); | |
let listener = TcpListener::bind(format!("0.0.0.0:{port}"))?; | |
loop { |
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 anyhow::anyhow; | |
use aws_sdk_s3::{ | |
model::{CompletedMultipartUpload, CompletedPart}, | |
ByteStream, Client as S3Client, | |
}; | |
use futures::{StreamExt, TryStreamExt}; | |
use tokio::io::AsyncRead; | |
use tokio_util::io::ReaderStream; | |
pub async fn upload_file( |
NewerOlder