Skip to content

Instantly share code, notes, and snippets.

View digitalcoyote's full-sized avatar

Curtis Carter digitalcoyote

View GitHub Profile
@digitalcoyote
digitalcoyote / purge.txt
Created August 27, 2018 21:24
A one-liner for removing a file/folder from a git repo
git filter-branch --index-filter "git rm --cached -f -r --ignore-unmatch <file/folder name>" -f --prune-empty -d "<tempDirectory>" -- --all
@digitalcoyote
digitalcoyote / FindReplace.ps1
Created February 21, 2020 20:31
Powershell to Find and Replace in a very large file
Get-Content sourcefile.txt -ReadCount 5000
| Foreach-Object {$_.Replace('OldText', 'NewText')}
| Set-Content result.txt
@digitalcoyote
digitalcoyote / VulnerabilityTests.ps1
Last active July 15, 2022 17:13
Report Yarn audit's reported vulnerabilities to TeamCity
#!/usr/bin/pwsh
$Audit = (yarn npm audit -A --json | ConvertFrom-Json)
"##teamcity[blockOpened name='YarnAudit' description='yarn npm audit -R -A']"
Foreach ($advisory in $Audit.advisories.PSObject.Properties){
$overview = $advisory.Value.overview -replace('[\|]', '||') -replace('[\[]', '|[') -replace('[\]]]','|]') -replace('[\n]', '|n') -replace('[\r]', '|r') -replace('['']', '|''') -replace('\\u','|0x')
"##teamcity[buildProblem description='Advisory for $($advisory.Value.findings[0].paths[0].Split('>')[-1]): $($advisory.Value.url) | $overview' identity='VulnerableDependency']"
}
"##teamcity[blockClosed name='YarnAudit']"
@digitalcoyote
digitalcoyote / Translate.rs
Created April 12, 2024 03:00
Unreviewed Rust App created entirely with Gemini AI (Treat with Caution)
extern crate reqwest;
extern crate serde_json;
extern crate google_translate3 as translate;
use std::fs::File;
use std::io::{Read, Write};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Replace with your filenames
let english_file = "i18n_en.json";
let target_lang = "es";