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
Run a rust file as a script! | |
1: Install nightly | |
$ rustup install nightly | |
2: Set the script as executable | |
$ chmod +x script.rs | |
3: Profit! | |
$ ./script.rs |
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::io::{Read, Write}; | |
use tokio; | |
use cmd_lib::run_fun; | |
use tower::ServiceBuilder; | |
use tower_http::cors::CorsLayer; | |
use flate2::bufread::GzDecoder; | |
use docx_rs::read_docx; | |
use base64::{Engine as _, engine::general_purpose}; | |
use serde::Deserialize; |
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
type Optional<T> = T | null; | |
type CheckFunction<T> = (val: T) => boolean; | |
type TransformFunction<T> = (val: T) => T; | |
interface Typedef<T = JSONType> { | |
type: T, | |
presence?: "required" | "optional", | |
check?: CheckFunction<T>, | |
default?: T, | |
transform?: TransformFunction<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
""" | |
livereload.py - quick "hot reloading" of small python scripts | |
demo video: https://imgur.com/a/fLbfHIG | |
""" | |
import sys | |
import os | |
import time | |
import traceback |