Skip to content

Instantly share code, notes, and snippets.

Arnav Singh Arnavion

Block or report user

Report or block Arnavion

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
#![deny(rust_2018_idioms, warnings)]
#![deny(clippy::all, clippy::pedantic)]
//! This crate defines a `launder` macro that can be used to create a borrow that is scoped to the block where this macro is invoked,
//! even if the expression to create the borrow returns a `'static` borrow.
/// This macro can be used to create a borrow that is scoped to the block where this macro is invoked,
/// even if the expression to create the borrow returns a `'static` borrow.
/// For example, dereferencing a raw pointer with `&*` creates a borrow with an arbitrary lifetime which can be `'static`.
Arnavion / ip-flash.awk
Created Nov 18, 2019
Flash Raspberry Pi's IP address using its LED
View ip-flash.awk
#!/usr/bin/awk -f
while (1) {
split(exec_line_match("ip addr show dev eth0", " inet "), ip_a_parts, " ")
split(ip_a_parts[2], ip_value_parts, "/")
split(ip_value_parts[1], ip_parts, ".")
Arnavion /
Last active Nov 30, 2019
Steam in Docker
# Start here. This builds the docker-games container image.
set -euo pipefail
mkdir -p ~/docker-games/
docker image rm -f docker-games || :
RIDL!{#[uuid(0xc4fec28f, 0x7966, 0x4e95, 0x9f, 0x94, 0xf4, 0x31, 0xcb, 0x56, 0xc3, 0xb8)]
interface ID3D12Object(ID3D12ObjectVtbl): IUnknown(IUnknownVtbl) {
fn GetPrivateData(
guid: *mut GUID,
pDataSize: *mut UINT,
pData: *mut c_void,
fn SetPrivateData(
guid: *mut GUID,
DataSize: UINT,
// Implements ISpellCheckerFactory
// Implements IUserDictionariesRegistrar
pub struct SpellCheckerFactory {
_use_cocreateinstance_to_instantiate: (),
impl SpellCheckerFactory {
pub fn uuidof() -> GUID {
RIDL!{#[uuid(0xdc12a681, 0x737f, 0x11cf, 0x88, 0x4d, 0x00, 0xaa, 0x00, 0x4b, 0x2e, 0x24)]
interface IWbemClassObject(IWbemClassObjectVtbl): IUnknown(IUnknownVtbl) {
fn GetQualifierSet(
ppQualSet: *mut *mut IWbemQualifierSet,
fn Get(
wszName: LPCWSTR,
lFlags: i32,
pVal: *mut VARIANT,
pType: *mut i32,
Arnavion /
Created Aug 14, 2018
winapi-tlb-bindgen-bin taskschd.dll
RIDL!{#[uuid(0x79184a66, 0x8664, 0x423f, 0x97, 0xf1, 0x63, 0x73, 0x56, 0xa5, 0xd8, 0x12)]
interface ITaskFolderCollection(ITaskFolderCollectionVtbl): IDispatch(IDispatchVtbl) {
fn get_Count(
pCount: *mut i32,
fn get_Item(
index: VARIANT,
ppFolder: *mut *mut ITaskFolder,
fn get__NewEnum(
STRUCT!{struct UUID {
Data1: i32,
Data2: i16,
Data3: i16,
Data4: [u8; 8],
fmtid: UUID,
pid: i32,
Arnavion /
Created Sep 8, 2017

A tiny crate that provides async and await macros to create futures::Futures and futures::Streams.

Code that uses these macros requires #![feature(conservative_impl_trait, generators)]

  • Returning a futures::Future

     #![feature(conservative_impl_trait, generators)]
Arnavion / cargoall.ps1
Created May 16, 2017
Recurse into workspace crates / subdirectories and run the given command
View cargoall.ps1
function cargoall ([ScriptBlock] $ScriptBlock) {
if (Test-Path '.\Cargo.toml') {
# Workspace root
(cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages |
%{ ([System.IO.FileInfo] $_.manifest_path).Directory } |
Write-Host -ForegroundColor Green $_.FullName
Push-Location $_
You can’t perform that action at this time.