Skip to content

Instantly share code, notes, and snippets.

View robherley's full-sized avatar

Rob Herley robherley

View GitHub Profile
@robherley
robherley / README.md
Last active September 28, 2023 19:12
Go Azure Blob SDK Repro

Context

When trying to call Blob Batch Delete API via Azure Go SDK, any requests to blob paths with / don't correctly form the Authorization header that the server is expecting.

Output

2023/09/28 15:10:12 uploading "file1.txt" with content "This can be deleted"
2023/09/28 15:10:12 uploading "foo/bar/file2.txt" with content "This can't be deleted"
2023/09/28 15:10:12 ℹ️  deleting "file1.txt"
@robherley
robherley / README.md
Last active September 28, 2023 17:59
Azurite Repro

Context

I'm using Azurite for some integration tests, and I noticed some odd behavior with the Blob Batch API when using a hostname instead of an IP address.

Related to:

The subrequests will fail when calling delete with a hostname with ResourceNotFound because it's incorrectly calculating the account and container names.

For example, for the request:

@robherley
robherley / zips.go
Created May 1, 2023 13:14
Streaming combine zips
package main
import (
"archive/zip"
"io"
"net/http"
"path/filepath"
)
func downloadZips(w io.Writer) error {
@robherley
robherley / README.md
Created April 25, 2023 21:04
Efficiently reading files from big zips from Azure Blob

Efficiently reading files from big zips from Azure Blob

Run go run main.go to test:

2023/04/25 17:02:26.660597 blob size is 10592348960 bytes, which is ~ 10101 MB
2023/04/25 17:02:26.660668 reading 1024 bytes from azblob from offset 10592347936
2023/04/25 17:02:26.680128 reading 20 bytes from azblob from offset 10592348918
2023/04/25 17:02:26.695184 reading 56 bytes from azblob from offset 10592348862
2023/04/25 17:02:26.710803 reading 4096 bytes from azblob from offset 10592340479
@robherley
robherley / fish.md
Created January 19, 2023 16:23
🐟

:fishsticks:

# set manual
ipmitool -I lanplus -H 10.0.0.99 -U root -P '<pass>' raw 0x30 0x30 0x01 0x00
# 15%
ipmitool -I lanplus -H 10.0.0.99 -U root -P '<pass>' raw 0x30 0x30 0x02 0xff 0x0f
This file has been truncated, but you can view the full file.
A:01 F:B0 B:00 C:13 D:00 E:D8 H:01 L:4D SP:FFFE PC:0100 PCMEM:00,C3,13,02
A:01 F:B0 B:00 C:13 D:00 E:D8 H:01 L:4D SP:FFFE PC:0101 PCMEM:C3,13,02,CE
A:01 F:B0 B:00 C:13 D:00 E:D8 H:01 L:4D SP:FFFE PC:0213 PCMEM:21,00,40,C3
A:01 F:B0 B:00 C:13 D:00 E:D8 H:40 L:00 SP:FFFE PC:0216 PCMEM:C3,00,02,00
A:01 F:B0 B:00 C:13 D:00 E:D8 H:40 L:00 SP:FFFE PC:0200 PCMEM:47,11,00,C0
A:01 F:B0 B:01 C:13 D:00 E:D8 H:40 L:00 SP:FFFE PC:0201 PCMEM:11,00,C0,0E
A:01 F:B0 B:01 C:13 D:C0 E:00 H:40 L:00 SP:FFFE PC:0204 PCMEM:0E,10,2A,12
A:01 F:B0 B:01 C:10 D:C0 E:00 H:40 L:00 SP:FFFE PC:0206 PCMEM:2A,12,1C,20
A:C3 F:B0 B:01 C:10 D:C0 E:00 H:40 L:01 SP:FFFE PC:0207 PCMEM:12,1C,20,FB
A:C3 F:B0 B:01 C:10 D:C0 E:00 H:40 L:01 SP:FFFE PC:0208 PCMEM:1C,20,FB,14
@robherley
robherley / key.sh
Created December 1, 2022 00:07
idk man
#!/usr/bin/env bash
KEY="SOMETHING-$(date -u +%Y-%m-%dT%H:%M:%SZ)"
ACCOUNT_KEY="SOMETHING-ELSE"
# sign <key> <account key>
function sign(){
b64_key=$(echo -n "$2" | base64)
payload=$(echo -n "$1" | openssl sha256 -hmac "$b64_key")
@robherley
robherley / hubber.go
Last active June 8, 2022 17:25
Sort by ID
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"sort"
)