Skip to content

Instantly share code, notes, and snippets.

View praetoriansentry's full-sized avatar

John Hilliard praetoriansentry

View GitHub Profile
@praetoriansentry
praetoriansentry / ecrecover.org
Created January 21, 2024 13:41
Polygon ecrecover header example

The signer can be recovered by taking a block, constructoring the headers and then using the Ecrecover of the go-ethereum crypto library.

First, we’ll download a block, extract the result using jq and then save the response in block.json.

curl -s -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "id": 1, "method": "eth_getBlockByNumber", "params": ["0x31b7feb", true]}' https://polygon-rpc.com | jq '.result' | tee block.json
@praetoriansentry
praetoriansentry / paste.el
Created October 31, 2023 12:11
Emacs Org Mode paste current image clipboard as file
(defun paste-current-image ()
"Assume the current clipboard contains and image and paste it into the org file"
(interactive)
(setq filename
(concat
(make-temp-name
(concat (buffer-file-name)
"_"
(format-time-string "%Y%m%d_%H%M%S_")) ) ".png"))
(call-process "xclip" nil (list :file filename) nil "-selection" "clipboard" "-t" "image/png" "-o")
package main
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
@praetoriansentry
praetoriansentry / main.go
Created March 4, 2019 15:39
Program to find crc32 collision
package main
import (
"fmt"
"hash/crc32"
"io/ioutil"
"log"
"runtime"
"strings"
"sync"
@praetoriansentry
praetoriansentry / quine.js
Last active March 3, 2019 19:36
Javascript version of a quine with contact info for card or something
const name = 'John Hilliard';
const company = 'Next Jump';
const twitter = '@praetorian';
const site = 'john.dev';
const crc32 = 0xd6d8c236;
const q = String.fromCharCode(34);
[
"const name = 'John Hilliard';",
"const company = 'Next Jump';",
"const twitter = '@praetorian';",
@praetoriansentry
praetoriansentry / quine.sh
Created February 28, 2019 14:13
My first quine written in bash
#!/bin/bash
# Quine John Hilliard
prog=(
'#!/bin/bash'
'# Quine John Hilliard\n'
'prog=('
')'
'q=$(printf "\x27")'
'for i in \`seq 0 2\`; do'
(function() {
var pres = document.querySelectorAll("#images pre");
var len = pres.length;
for(var i = 0; i < pres.length; i = i + 1) {
pres[i].style.display = 'none';
}
var a = 0;
window.setInterval(function() {
pres[a].style.display = 'none';
pres[(a + 1)%len].style.display = 'block';

Keybase proof

I hereby claim:

  • I am praetoriansentry on github.
  • I am praetoriansentry (https://keybase.io/praetoriansentry) on keybase.
  • I have a public key whose fingerprint is 14C9 1CB9 4181 7357 85C6 ED48 F135 DEFB 670D 0ACB

To claim this, I am signing this object:

.date-link {
font-size: 12px;
margin-bottom: 10px;
}