Skip to content

Instantly share code, notes, and snippets.

View valarauca's full-sized avatar

Cody Laeder valarauca

  • San Jose CA
View GitHub Profile
@valarauca
valarauca / Search.md
Last active May 6, 2025 20:50
Making Google Search -actually- useful.

Within Firefox

Go into settings (hamburger menu in top right by default) image

Go into Search (left side, 3rd option) image

Scroll to the bottom to see Search Shortcuts

@valarauca
valarauca / chaosDruid.troll
Last active December 16, 2021 20:50
herblore xp per chaos druid (fuzzy)
\\ No the language doesnt have a case statement
\\ all xp values have their decimal truncated b/c troll doesnt
\\ have robust floating point support.
function herbloreXPRoll(x) =
if 32>=x then
\\ clean + attack potion
27
else if 56>=x then
\\ clean + anti-poison
41
impl<'i, B> FromPercentEncoded<'i> for Cow<'i, B>
where
B: ToOwned,
&'i B: FromPercentEncoded<'i>,
<&'i B as FromPercentEncoded<'i>>::StrError: MaybeCannotGrowError,
<&'i B as FromPercentEncoded<'i>>::BytesError: MaybeCannotGrowError,
B::Owned: FromPercentEncoded<'i>,
{
type BytesError = CowError<
<B::Owned as FromPercentEncoded<'i>>::BytesError,
#!/usr/bin/env bash
shopt -slastpipe
declare -i last_n="${1}"
git log -n $last_n | awk '$1 == "commit" { print $2 }' | readarray -t commits
for commit in "${commits[@]}"
do
git checkout "$commit" &>/dev/null
cargo clean &>/dev/null
@valarauca
valarauca / NewRez.t
Created September 28, 2020 22:17
NewRezProtocol
function Complete(PoolSize, RemainingModels, WoundsPerModel)= if RemainingModels=0 then 1 else if PoolSize=0 then 1 else if PoolSize<WoundsPerModel then 1 else 0
function RPRoll(PoolSize, RemainingModels, WoundsPerModel,Success)= if 1 <= sum WoundsPerModel <= ( count Success <= PoolSize d6 ) then 1 else 0
function PRRollRecursive(PoolSize, RemainingModels, WoundsPerModel, Success)=
if (call Complete(PoolSize, RemainingModels, WoundsPerModel))=1 then
0
else
if (call RPRoll(PoolSize, RemainingModels, WoundsPerModel,Success)) = 1 then
1 + call PRRollRecursive(PoolSize-WoundsPerModel, RemainingModels-1, WoundsPerModel, Success)
@valarauca
valarauca / move_mouse.sh
Created May 22, 2020 19:03
causes your mouse to move so you look online
#!/bin/bash
hash xdotool &>/dev/null || {
echo -e "failed to find xdotool.\nPlease install xdotool" >&2;
exit 1;
}
function move_mouse() {
declare -i distance="${1}"
declare -i angle="${2}"
thread '<unnamed>' panicked at 'already borrowed: BorrowMutError', /checkout/src/libcore/result.rs:906:4
stack backtrace:
0: 0x560b2ac20523 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::h1070d2fb95184fa2
at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: 0x560b2ac1e208 - std::panicking::default_hook::{{closure}}::hd87027f00dc92814
at /checkout/src/libstd/sys_common/backtrace.rs:69
at /checkout/src/libstd/sys_common/backtrace.rs:58
at /checkout/src/libstd/panicking.rs:381
2: 0x560b2ac1d660 - std::panicking::rust_panic_with_hook::h97def5bc16cf8ad9
at /checkout/src/libstd/panicking.rs:397
@valarauca
valarauca / name.rs
Created August 20, 2017 22:54
what I was trying to do
pub fn thing(id_req: String) -> impl IntoFuture<Item=DATA> {
GLOBAL_NAME_CACHE
.has_name(id)
.or_else(|x| match x {
Rename(name) => Ok(name),
e => Err(e)
})
.and_then(|x| Tx::ro(&x))
tp_block_size= 4096
tp_frame_size= 2048
tp_block_nr = 4
tp_frame_nr = 8
we will get the following buffer structure:
block #1 block #2
+---------+---------+ +---------+---------+
#[repr(C)] // <- tells Rust to treat this structure like its C
pub struct Tpacket {
block_size: u32,
block_number: u32,
frame_size: u32,
frame_number: u32
}