Skip to content

Instantly share code, notes, and snippets.

@BrendanLeber
BrendanLeber / README.md
Created January 21, 2023 20:46 — forked from peterbartha/README.md
Convert Rust books to EPUB (incl. The Rust Programming Language)

Convert Rust books to EPUB (incl. The Rust Programming Language)

The following steps work for all the HTML learning materials on the Learn Rust page:

  1. Click on the "Print this book" icon in the top right corner.
  2. "Cancel" print popup.
  3. Press F12.
  4. Copy, paste, and run the contents of ebookFormatPreparation.js into your browser's console.
  5. Save the modified HTML file.

Math

  • .s - Show the stack
  • +, -, *, mod - Math operators
  • /mod - performs both / and mod

Stack manipulation

  • drop and 2drop - drop a stack item (once / twice)
  • dup - duplicate a stack item
  • rot - rotate the stack
@BrendanLeber
BrendanLeber / YubiKey-GPG-SSH-guide.md
Created June 29, 2018 19:07 — forked from ageis/YubiKey-GPG-SSH-guide.md
Technical guide for using YubiKey series 4 for GPG and SSH

YubiKey 4 series GPG and SSH setup guide

Written for fairly adept technical users, preferably of Debian GNU/Linux, not for absolute beginners.

You'll probably be working with a single smartcard, so you'll want only one primary key (1. Sign & Certify) and two associated subkeys (2. Encrypt, 3. Authenticate).

@BrendanLeber
BrendanLeber / SetThreadName.h
Created November 6, 2012 20:08
Set the thread name for Visual Studio debugging.
#pragma once
#include <Windows.h>
const DWORD MS_VC_EXCEPTION = 0x406D1388;
#pragma pack(push, 8)
typedef struct tagTHREADNAME_INFO
{
DWORD dwType; // Must be 0x1000
LPCSTR szName; // Pointer to name (in user addr space)
@BrendanLeber
BrendanLeber / TimeFromString.cpp
Created November 6, 2012 19:27
A snippet to convert from a string to a SYSTEMTIME or FILETIME.
BOOL SystemTimeFromStr(__in LPCWSTR psz, LCID lcid, __out LPSYSTEMTIME pst)
{
DATE date;
return SUCCEEDED(VarDateFromStr(psz, lcid, 0, &date)) && VariantTimeToSystemTime(date, pst);
}
BOOL FileTimeFromStr(__in LPCWSTR psz, LCID lcid, __out LPFILETIME pft)
{
SYSTEMTIME st;
return SUCCEEDED(SystemTimeFromStr(psz, lcid, &st)) && SystemTimeToFileTime(&st, pft);