Skip to content

Instantly share code, notes, and snippets.

View djdv's full-sized avatar

djdv

  • Philadelphia, PA
  • 06:17 (UTC -04:00)
View GitHub Profile
@djdv
djdv / rplace.ps1
Last active August 10, 2020 01:57
recursive replace in files with regex args
# print the filename and the provided content (the file's contents with changes applied, indented rightward)
function rplacePrint {
param(
[string]$fileName,
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]$content
)
Begin {
$fileName + ":" | Write-Host
}
Process {
iex 'ipfs pin ls --type=recursive -q' | % {
"Hash: " + $_
"Tree:"
iex 'ipfs ls $_' | % {
"`t" + $_
}
"`n"
}
iex 'ipfs pin ls --type=recursive -q' | % {
iex 'ipfs ls $_'
$confirmation = Read-Host "Del?"
if ($confirmation -eq 'y') {
iex 'ipfs pin rm $_'
}
}
@djdv
djdv / ipfs-repo-regen.ps1
Created August 9, 2019 02:29
Attempts to remove and retrieve corrupt blocks, but it might not work 👀
#lol string parsing
$badBlocks = @()
"Verifying..."
iex 'ipfs repo verify' | % {
if ($_.StartsWith("block")) {
$block = $_.Split(" ")[1]
"Block $block is corrupted, adding to removal+retreival queue"
$badBlocks += ,$block
}
}

Keybase proof

I hereby claim:

  • I am djdv on github.
  • I am ddv (https://keybase.io/ddv) on keybase.
  • I have a public key whose fingerprint is BBFB 6592 8C82 407A F531 1054 2D1D 7B25 F432 6BEF

To claim this, I am signing this object: