Skip to content

Instantly share code, notes, and snippets.

View diagprov's full-sized avatar

Antony Vennard diagprov

View GitHub Profile
#!/bin/sh
function paper_nocover() {
if ! command -v qpdf &> /dev/null; then
echo "QPDF either not installed or not on the path."
return
fi
if ! command -v sha512sum &> /dev/null; then
/* compile with
cc -Wall -Werror -o bitfields bitfields.c
We rely on shift overflow to detect signedness in char/wchar_t types
*/
#include <limits.h>
#include <stdbool.h>
@diagprov
diagprov / goodreads.js
Last active December 27, 2021 21:31
Extract all data from Goodreads
$tbl = document.getElementById("books");
var bl = new Array();
for (let i = 1; i < $tbl.rows.length; i++) {
$row = $tbl.rows[i]
$htitlerow = $row.getElementsByClassName("field title")[0]
$htitleanchor = $htitlerow.getElementsByClassName("value")[0].childElements()[0]
$title = $htitleanchor.text
@diagprov
diagprov / flash.sh
Last active November 16, 2021 16:20
Flashing Android By Hand
# this comes from the Apache2-Licensed AOSP script.
# filenames in this script represent the Pixel 3 ("blueline")
# first Android 11 (RP1A) release.
# This didn't actually work, in my experience, but an almost
# identical (save the filenames) process worked for Android 9-10.
# you should update your SDK tools first.
if ! [ $($(which fastboot) --version | grep "version" | cut -c18-23 | sed 's/\.//g' ) -ge 2802 ]; then
echo "fastboot too old; please download the latest version at https://developer.android.com/studio/releases/platform-tools.html"
exit 1
[url "git@gitlab.com:"]
insteadOf = https://gitlab.com/
[url "git@github.com:"]
insteadOf = https://github.com/
function Install-DomainForest
{
<#
.SYNOPSIS
.DESCRIPTION
Creates a new Domain Forest
.LINK
.INSTRUCTIONS

Crypto Reading List

This is a small list of books and papers I put together on cryptography and cryptanalysis.

Mathematically focused is intended to highlight the fact the book does not shy away from Mathematics. If you want a simple, advanced-maths-free explanation you might find these books disappointing: please check first to make sure the level is suitable for you.

Keybase proof

I hereby claim:

  • I am diagprov on github.
  • I am arv (https://keybase.io/arv) on keybase.
  • I have a public key whose fingerprint is 4140 9D68 4511 8508 8AD6 68DF 1529 AC28 F36B 4495

To claim this, I am signing this object:

#include <stdint.h>
#include <stdlib.h>
#include <string.h>
template<size_t N>
bool ovid_memmove(uint8_t (&output_buffer)[N], uint8_t* source_buffer, size_t count)
{
size_t safe = min(N, count);
memmove(output_buffer, source_buffer, safe);
#!/usr/bin/python
import hashlib
import pefile
pe = pefile.PE("file.exe")
for resource_type in pe.DIRECTORY_ENTRY_RESOURCE.entries:
name = ""
if resource_type is not None: