Skip to content

Instantly share code, notes, and snippets.

View outfrost's full-sized avatar

outfrost

View GitHub Profile
@outfrost
outfrost / drop_empty.rs
Created February 3, 2024 01:25
Rust "extension method" to turn empty containers into Nones
fn main() {
let a = String::from("This is a test").drop_empty();
println!("{:?}", &a);
let b = String::from("").drop_empty();
println!("{:?}", &b);
let c = vec![0, 69, 420].drop_empty();
println!("{:?}", &c);
}
trait DropEmpty: Sized {
@outfrost
outfrost / rwby.md
Last active December 14, 2023 07:13
How to RWBY

How to RWBY

Rooster Teeth is chaos, and you just wanna enjoy RWBY. This is a quick guide how to.

Watching for free

Make an account on https://roosterteeth.com to make the "make an account" popups go away. Go into settings -> playback and set your video quality and preferred volume.

In chronological order:

@outfrost
outfrost / bracket_calculator.rs
Created July 20, 2023 16:05
Some garbage to test out tournament bracket ideas
use std::{collections::BTreeMap, mem};
use rand::prelude::*;
const BIT_INDEX_DEF: [((u32, u32), u32); 28] = [
((0, 1), 0),
((0, 2), 1),
((0, 3), 2),
((0, 4), 3),
((0, 5), 4),
((0, 6), 5),
@outfrost
outfrost / montyhall.rs
Last active June 19, 2023 14:05
Procedural illustration of the Monty Hall problem
use rand::{thread_rng, Rng};
const DOORS: u32 = 3;
const ROUNDS: u32 = 1000000;
const SWITCH: bool = true;
fn main() {
if DOORS < 3 {
panic!("Doesn't work for fewer than 3 doors.");
}
@outfrost
outfrost / dynamic_cast.cpp
Last active February 14, 2023 15:20
C++ dynamic_cast runtime overhead
/**
* CXXFLAGS := -std=c++17 -O3 -pedantic -Wall -Wextra ${CXXFLAGS}
* LDLIBS := -lstdc++ ${LDLIBS}
*
* Example stderr on AMD Ryzen 7 5800X, with gcc 10.2.1, Linux 4.4.0-19041-Microsoft (WSL, W10 Pro 22H2):
*
* static avg: 64121 ns
* dynamic avg: 75674 ns
*/
@outfrost
outfrost / photosync.sh
Created January 3, 2023 20:15
Automatically pull new photos and videos from Android phone via adb
#!/bin/sh
devicePrefix="Pixel"
count() { # args...
echo $#
}
which combine >/dev/null 2>&1 || {
echo "error: Missing 'combine' utility" >&2
@outfrost
outfrost / ld47-themes-yes.rs
Last active September 23, 2020 14:53
Ludum Dare Theme Slaughter: theme ideas you've kept so far
use std::{collections::HashMap, env, fs};
use serde::{Deserialize, Serialize};
use serde_json;
#[derive(Deserialize, Serialize)]
struct Ideas {
pub status: u16,
pub caller_id: u64,
pub ideas: HashMap<String, String>,
@outfrost
outfrost / rustconf-times.html
Created August 20, 2020 01:22
RustConf 2020 times
<!--
Copyleft 2020 Outfrost
This is free and unencumbered work released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this work, either in source code or rendered form, for any purpose, and by any means.
The work is provided without warranty of any kind, express or implied.
-->
Outfr0st: Don't be afraid to say "I don't know/remember, I'd have to check with (resource)"
Outfr0st: Know something about the employer, where they've been and what they've been doing
FreckledFiberworks: Absolutely. I had a phone interview about a month ago and we tackled that part of things, but now I know so much more about what they do and what they care about. :D
Outfr0st: Maybe prepare some questions you'd wanna ask the interviewer(s) when they give you the opportunity, I've heard sometimes being inquisitive about details of the job and the company helps noticeably
Outfr0st: One more I can think of is be prepared to talk about everything on your resume, and connections between those things. In my last interview, I was asked how I combined a skill or useful habit of mine with the last work I'd done which was an internship.
@outfrost
outfrost / An Open Letter to Steam.txt
Created December 13, 2019 02:45
An Open Letter to Steam
An Open Letter to Steam
To whom it may concern,
This is an official open letter directed to Valve Corporation, developer of the video game distribution platform Steam. We are a group of Hong Kongers who submitted the game “Liberate Hong Kong” (1179160) onto Steam on the 18th of October, 2019 (Ticket: HT-DQ6T-RM25-44V5).
“Liberate Hong Kong” is a virtual experience meant to enable people all around the world to comprehend the demonstrations organized by Hong Kong protestors in the current Anti-ELAB movement. Players can dive into the first-person perspective of a protestor during a handful of confrontations with the local police force and the government's regime.
The extremely slow progress of reviewing our submission has made us raise some questions. It has also come to our attention that a dystopian visual novel “Karma”, submitted to Steam, took a similarly questionable amount of time to review and publish. The developer of “Karma” stated that “revenue made from Karma during first six months of its publi