Skip to content

Instantly share code, notes, and snippets.

View loren-osborn's full-sized avatar
💭
Open to Work

Loren Osborn loren-osborn

💭
Open to Work
  • Southern California
View GitHub Profile
@loren-osborn
loren-osborn / ChatGPT prompt to write gnu autotools detection for grep
Created November 18, 2023 23:50
I believe this is mostly misguided, but was hoping for some feedback
Please write a GNU autotools detection mechanism to test for `grep` on the target system, and if grep is present, detect it's capabilities to support EREs, PCREs, and the correct command line switches to put grep into that mode.
As autotools traditionally tests systems and/or tools for their support for individual features, to see if they are properly supported. My suggestion would be to test the grep command in four phase:
1. Including any possible shell builtins, find all grep variations (including`grep`, `egrep`, `fgrep`, etc.) that are defined or installed in the current shell path.
2. Enumerate all modal "production features" (not features like `--help` as it is intended as a user/developer aid, and not intended to be used within a script) and any command line flags/switches that have been used to enable them in any popular versions of grep, then determine which switches each version of grep variation recognizes and/or allows without generating an error. Ideally I would prefer to identify a long and sh
@loren-osborn
loren-osborn / staticcheck_s1021.go
Last active November 18, 2022 18:05
This is a demo of a proposed exception to warning S1021 in `staticcheck`
// Package main is a toy app demoing a defect in `staticcheck`s test for "S1021"
package main
import "fmt"
// Foo is a sample custom type
type Foo struct {
Value int
runabble func()
}
@loren-osborn
loren-osborn / extract_and_scramble_hashcat_hash.sh
Created March 29, 2020 23:01
script to extract (and then scramble) macOS user password hash from system .plist file
#!/bin/bash
extractOsXUserHash() {
xmlOfUsertPlist="$( \
plutil -convert xml1 - -o - \
)"
if [ -z "$xmlOfUsertPlist" ] ; then \
1>&2 echo "No input detected"
exit 127
fi
<?php
/**
* File to demonstrate isSubclassOf inconsistancy.
*/
use Go\ParserReflection\ReflectionClass as ParsedReflectionClass;
use Go\ParserReflection\ReflectionEngine as ParsedReflectionEngine;
use Go\ParserReflection\Locator\CallableLocator as MockLocator;
use Go\ParserReflection\Locator\ComposerLocator as RealLocator;
#!/opt/local/bin/python
from sympy import *
g, r, m, j = symbols('g r m j')
c, f, d, h = symbols('c f d h ')
# Eq((c+m)/j, g / d)
# Eq((c+m)/j, r / f)
Facter.add(:overridable_fact_dest) do
setcode do
Facter.value(:overridable_fact_src) || 'default_value'
end
end
@loren-osborn
loren-osborn / FooTester.php
Last active December 10, 2015 12:48 — forked from Spea/User.php
<?php
namespace Acme\DemoBundle\Entity;
// use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* FooTester
*