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
/* Example Usage: | |
#[repr(C,packed)] | |
struct Foo { | |
data1: [u8; 3], | |
data2: [u8; 5] | |
} | |
let baz: Foo = { | |
let mut baz_wip = core::mem::MaybeUninit::<Foo>::uninit(); | |
// 1. Writing fields: |
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
/* Written on Rust 1.77.2 (Stable), should run on even older builds. | |
Usage Example: | |
let my_buffer: [u8; 42] = randombytes().unwrap(); | |
*/ | |
extern crate getrandom; // https://github.com/rust-random/getrandom | |
use core::mem::MaybeUninit; |
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
// Step 1. construct object | |
let obj = await new Promise((resolve, reject) => { | |
const obj_pending = API_CONSTRUCTOR(); | |
obj_pending.addEventListener( | |
'error', | |
(event) => void reject(new Error( | |
`${event.target.__proto__.constructor.name}: ${event.type} event`, | |
{cause: event} | |
)), |
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
// This is also a demonstration of the Z-combinator. | |
// h/t https://thenewobjective.com/types-and-programming-languages/deriving-the-z-combinator | |
const Z = (f => (u => f((...x) => u(u)(...x)))(u => f((...x) => u(u)(...x)))); | |
/* Example usage: | |
a = new MessageChannel().port1; | |
b = new ArrayBuffer(42); | |
my_obj = {a, x: {b, a_again: a}} | |
get_transferables(my_obj); |
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
! James Edington Administrator – Popups | |
||accounts.google.com/gsi/iframe$subdocument |
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
// ==UserScript== | |
// @name UAH Transcript to TXT | |
// @namespace 9ae3b270-19ab-3cc1-827e-42cc8f3bf51c | |
// @version 0.0.4 | |
// @match https://ssbprod.uah.edu/PROD/bwskotrn.P_ViewTran | |
// @grant none | |
// @namespace james.edington@uah.edu | |
// ==/UserScript== | |
// To install from GitHub, click the "Raw" button on the top-right. |
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 Bitwise | |
require Logger | |
# "MEkDAgcAAgEgAh9n5rQmt3zJukGmwwvEVwfbZFS3NJ9oW7hgpJ0Db5ORAh8mOLmbP3+DfEQvEFbOcqymWoF6s9GHVcv8UegJBcWz" 3210790 1959110000000 | |
defmodule TS3H do | |
def cmd_main(argv) do | |
[pk_str, ctr_best, ctr_cur] = |
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
defmodule BitStringStream do | |
def binary_to_stream(s) do | |
Stream.unfold(s, fn | |
<<next::8, rem::binary>> -> {next, rem} | |
<<>> -> nil | |
end) | |
end | |
def bitstring_to_stream(s, n) do |
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
from contextlib import contextmanager, ExitStack | |
import io | |
__all__ = ['maybe_open'] | |
@contextmanager | |
def maybe_open(file_or_path, mode, *, **k, mode_strict=False): | |
with ExitStack() as _inner_ctx: | |
if isinstance(file_or_path, io.IOBase): |
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
"""*BufferLike*, a quasi-ponyfill for collections.abc.Buffer | |
When collections.abc.Buffer is available, exports it directly. | |
Otherwise, crudely constructs an Abstract Base Class via mass ABC.register(). | |
May not be suitable for all use-cases.""" | |
try: | |
# version_info >= (3, 12) | |
from collections.abc import Buffer as BufferLike | |
except ImportError: |
NewerOlder