Dumping some code from ~May 2022. Intended to accompany blog post or something.

Overview

An example project where Rust code prints the length of an uploaded file.

Run python3 -m http.server (or equivalent: https://gist.github.com/willurd/5720255), then access http://[::]:8000/

Writing a "pdf file object parser". Starting with parsing individual objects. There are 8 types of objects:

  • Boolean Objects
  • Numeric Objects
  • String Objects
  • Name Objects
  • Array Objects
  • Dictionary Objects
  • Stream Objects
  • Null Object

We will also need to parse

  • Indirect Object definitions (12 0 obj)
  • Indirect object references (12 0 R),
  • File structure: Header, body, cross-reference table, trailer.

Some notes:

  • It can now round-trip (objects, not yet an entire PDF file) via JSON. That is, if you dump to JSON and read back, you will get the exact same bytes.

    • This is not as big a deal as it sounds, because we could in principle dump the sequence of bytes into JSON as an array of numbers. However, here we're doing slightly more than that.
  • Assumes the input is valid, e.g. does not check in dict for unique keys, does not check for stream length, etc.

Status currently:

  • Out of 19560 PDF files I have, this works correctly for 8724 of them.

  • As of 2022-04-30 (970471e): Works for 19262 out of 19560 files. So fails for 298 (not all of which are actually PDF files).

  • As of 2022-05-01 (child of 970471e): Works for 19430 out of 19562 files. So fails for 132 files.

  • As of 2022-05-01 (after deleting some dupes): Works for 19382 out of 19493 files. So fails for 111 files.

  • As of 2022-05-01 11:52: Works for 19420 out of 19493 files. So fails for 73 files.

  • As of 2022-05-01 14:20 (e54b45e): Works for 19426 out of 19492 files. So "fails" for 66 files. Looked at each of them. They are all malformed in some way or the other.

You might also like...
Minimalist multi-track audio recorder which may be controlled via OSC or MIDI.
Minimalist multi-track audio recorder which may be controlled via OSC or MIDI.

smrec Minimalist multi-track audio recorder which may be controlled via OSC or MIDI. I did this because I needed a simple multi-track audio recorder w

Sample code of Yew (0.18). Something like a PuyoPuyo.

RusRus Requirements Docker Depend on Yew ver 0.18.0 Usase docker build -t rusrus . # start serve docker run -p 8080:8080 --rm -it -v $(pwd):/app -w /

Code examples for https://www.poor.dev/blog/terminal-anatomy/

This repository contains examples from the Anatomy of a Terminal Emulator blog post. Each folder contains a separate example and can be run separately

Cassette A simple, single-future, non-blocking executor intended for building state machines.

Cassette A simple, single-future, non-blocking executor intended for building state machines. Designed to be no-std and embedded friendly. This execut

πŸ€– brwrs is a new protocol running over TCP/IP that is intended to be a suitable candidate for terminal-only servers

brwrs is a new protocol running over TCP/IP that is intended to be a suitable candidate for terminal-only servers (plain text data). That is, although it can be accessed from a browser, brwrs will not correctly interpret the browser's GET request.

Programming language from down under, inspired by this Reddit post.
Programming language from down under, inspired by this Reddit post.

aussie++ Programming language from down under, inspired by this Reddit post. View live demo here. Special thanks to MarkWhyBird, louis100, and others

πŸ’« Small microservice to handle state changes of Kubernetes pods and post them to Instatus or Statuspages

πŸ’« Kanata Small microservice to handle state changes of Kubernetes pods and post to Instatus πŸ€” Why? I don't really want to implement and repeat code

xcp is a (partial) clone of the Unix cp command. It is not intended as a full replacement

xcp is a (partial) clone of the Unix cp command. It is not intended as a full replacement, but as a companion utility with some more user-friendly feedback and some optimisations that make sense under certain tasks (see below).

A cross-platform Mod Manager for RimWorld intended to work with macOS, linux and Windows

TODOs are available here. Discussions, PRs and Issues are open for anyone who is willing to contribute. rrm Inspired by Spoons rmm. This is a cross-pl

A Supra + Pandoc post-processor for footnote cross-references.

AutoCref AutoCref is a Supra and Pandoc post-processor that turns footnote cross-references in a Word document into automatically updated fields. Abou

Command-line HTTP client for sending a POST request to specified URI on each stdin line.

line2httppost Simple tool to read lines from stdin and post each line as separate POST request to a specified URL (TCP connection is reused though). G

Rosenpass is a formally verified, post-quantum secure VPN that uses WireGuard to transport the actual data.

Rosenpass README This repository contains A description of the Rosenpass protocol The reference implementation of the protocol – the rosenpass tool A

Apply a pixelation effect to any Bevy mesh or scene without post-processing.
Apply a pixelation effect to any Bevy mesh or scene without post-processing.

Pixelate Mesh Apply a pixelation effect to any Bevy mesh or scene without post-processing. Usage Add the PixelateMeshPlugin, where you specify a compo

convert images to ansi or irc, with a bunch of post-processing filters
convert images to ansi or irc, with a bunch of post-processing filters

img2irc (0.2.0) img2irc is a utility which converts images to halfblock irc/ansi art, with a lot of post-processing filters halfblock means that each

Simple and minimalist forward auth service intended for use with reverse proxies (Traefik, Caddy, nginx, etc)
Simple and minimalist forward auth service intended for use with reverse proxies (Traefik, Caddy, nginx, etc)

nforwardauth nforwardauth is an extremely lightweight, blazing fast forward auth service that lets you use a single authentication middleware for all

An handy tool that is intended to help your inventory cleanup or dump.

NeosVR Inventory Management Notes to foreign users This readme is written in Japanese. Please use external tool to translate this document into your l

Minimal Bitcoin wallet intended for teaching rust-bitcoin

Insanely minimal Bitcoin wallet intended for demonstration of Rust Bitcoin ecosystem Absolutely DO NOT use with mainnet funds!!! No privacy - address

LSP inline hints for Lua, intended for use with Neovim.
LSP inline hints for Lua, intended for use with Neovim.

luahint LSP inline hints for Lua, intended for use with Neovim. Now that inline hints are working in Neovim nightly, I figured I'd attempt to build an

A blazinlgy fast πŸš€ transpiler written in rust πŸ¦€ that fixes (pun intended) your problems

Pissfix πŸš€ Pissfix is a blazingly fast πŸš€ programming language that transpiles to a "interesting" and not well known programming language called "Post

Comments
  • Document everything

    Document everything

    I just read Coping strategies for the serial project hoarder by Simon Willison (simonw), which recommends writing everything down, working issue-first (create an issue, talk to yourself, etc) and basically leave things in a sane state that you can walk away from at any point, so that there isn't any guilt. Sounds like a great state to aspire to!

    The first step would be to document what already exists, from a POV of "if I don't do any more work on this project, whatever already exists should still make sense".

    opened by shreevatsa 0
Owner
Shreevatsa
Shreevatsa
Ointers is a library for representing pointers where some bits have been stolen so that they may be used by the programmer for something else

Ointers is a library for representing pointers where some bits have been stolen so that they may be used by the programmer for something else. In effect, it's a small amount of free storage

Irrustible 8 Jun 4, 2022
Code for blog post "{n} times faster than C, where n = 128"

Code for {n} times faster than C, where n = 128 Actually, n = 290 ?? Benchmark Setup Rust version: rustc 1.70.0 (90c541806 2023-05-31) Run test: cargo

Thomas Ip 9 Jul 24, 2023
Something something B language.

badc A terrible, dirty, no-good, rotten B compiler. Written by one really great human being, and one obscenely terrible sheep. Contributing Don't. Ref

The Phantom Derpstorm 8 Nov 12, 2022
A demo blog post engine in Rust, using Rocket and MongoDB

A demo blog post engine written in Rust, using Rocket and MongoDB Quick Start Setup a new MongoDB cluster https://cloud.mongodb.com/ create a new data

Nabil Hachicha 5 Oct 19, 2022
A utility written in Rust for dumping binary information out of Mach-O files inspired by objdump

Mach-O Dump (macho-dump) An objdump like tool for exploring and manipulating Mach-O files. Note: This project is in an early stage and most of the fea

Irides 2 Oct 17, 2022
Rust-blog - Educational blog posts for Rust beginners

pretzelhammer's Rust blog ?? I write educational content for Rust beginners and Rust advanced beginners. My posts are listed below in reverse chronolo

kirill 5.2k Jan 1, 2023
This is a small demo to accompany the Tauri + Yew tutorial

Tauri + Yew Demo This is a small demo to accompany the Tauri + Yew tutorial

Steve Pryde 94 Jan 2, 2023
A tetris game I wrote in rust using ncurses. I'm sure that there's a better way to write a tetris game, and the code may be sus, but it techinically works

rustetris A tetris game I wrote in rust using ncurses. I'm sure that there's a better way to write a tetris game, and the code may be sus, but it tech

Eric G 3 Oct 15, 2022
TCP is so widely used, however QUIC may have a better performance.

TCP is so widely used, however QUIC may have a better performance. For softwares which use protocols built on TCP, this program helps them take FULL advantage of QUIC.

zephyr 15 Jun 10, 2022
A Rust library for evaluating log4j substitution queries in order to determine whether or not malicious queries may exist.

log4j_interpreter A Rust library for evaluating log4j substitution queries in order to determine whether or not malicious queries may exist. Limitatio

Fastly 22 Nov 7, 2022