<?xml version="1.0" encoding="utf-8"?>
<unattend
xmlns="urn:schemas-microsoft-com:unattend"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<!--https://schneegans.de/windows/unattend-generator/?LanguageMode=Unattended&UILanguage=en-US&Locale=en-US&Keyboard=00000409&GeoLocation=244&ProcessorArchitecture=amd64&BypassRequirementsCheck=true&ComputerNameMode=Custom&ComputerName=test&TimeZoneMode=Implicit&PartitionMode=Unattended&EspSize=300&PartitionLayout=MBR&RecoveryMode=Partition&RecoverySize=1000&WindowsEditionMode=Unattended&WindowsEdition=pro&UserAccountMode=Unattended&AccountName0=user&AccountPassword0=password&AccountGroup0=Administrators&AccountName1=&AccountName2=&AccountName3=&AccountName4=&AutoLogonMode=Own&PasswordExpirationMode=Unlimited&LockoutMode=Disabled&DisableDefender=true&DisableDefenderPE=true&DisableSystemRestore=true&EnableLongPaths=true&EnableRemoteDesktop=true&AllowPowerShellScripts
/* | |
* Copyright (C) 2018, Emilio G. Cota <[email protected]> | |
* | |
* License: GNU GPL, version 2 or later. | |
* See the COPYING file in the top-level directory. | |
*/ | |
#include <inttypes.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
#include <string.h> |
#[macro_export] | |
// https://stackoverflow.com/a/70222282 | |
macro_rules! field_size { | |
($t:ident :: $field:ident) => {{ | |
let m = core::mem::MaybeUninit::<$t>::uninit(); | |
// According to https://doc.rust-lang.org/stable/std/ptr/macro.addr_of_mut.html#examples, | |
// you can dereference an uninitialized MaybeUninit pointer in addr_of! | |
// Raw pointer deref in const contexts is stabilized in 1.58: | |
// https://github.com/rust-lang/rust/pull/89551 | |
let p = unsafe { core::ptr::addr_of!((*(&m as *const _ as *const $t)).$field) }; |
macro_rules! parse_enum_variant { | |
{ | |
$(#[$enum_meta:meta])*, | |
$vis:vis, | |
$name:ident, | |
$(<$($generic_param:tt),*>)?, | |
@where_clauses {$($where:tt)*}, | |
@parse {$($eout:tt)*}, | |
#[$variant_meta:meta] | |
$($rest:tt)* |
const puppeteer = require("puppeteer"); | |
const child_process = require("child_process"); | |
const fs = require("fs"); | |
async function sh(cmd) { | |
return new Promise(function (resolve, reject) { | |
child_process.exec(cmd, (err, stdout, stderr) => { | |
if (err) { | |
resolve(err); | |
} else { |
I've been using Fedora Linux for a couple years now, and this week
I wanted to write a kernel module for some reasons. Of course, I try
to write all software I possibly can in Rust, and Linux
recently has support for writing
modules, including
out of tree
modules, in Rust! Great, so it should be really easy, just copy the
rust-out-of-tree-module
Makefile
and Kbuild
, run make
, and
I used to have a site bookmarked with a table of all these functions, but the link is dead. Here's a matrix of Option and Result conversion functions. These become second nature once you have used Rust for any significant length of time, but it's useful to have a table reference.
For each of the below:
T
is the value possibly contained in an inputOk
Result
orSome
Option
.U
is a new value created by transforming or replacing an inputT
. Note that whenU
appears in methods likemap
,U ?= T
, for example by calling
I'm doing some ELF parsing and I need to simulate ld.so
's lookup routine (man ld.so
).
To do that, I need to grab RPATH
as well as RUNPATH
from binaries, so to test my tool
I naturally need to make some binaries with each of those. Here's how you do it.
cat <<EOF > /tmp/a.c
int main(){}
EOF