Skip to content

Instantly share code, notes, and snippets.

View jonfazzaro's full-sized avatar
💭
Probably off looking for a cup of coffee.

Jon Fazzaro jonfazzaro

💭
Probably off looking for a cup of coffee.
View GitHub Profile
@jonfazzaro
jonfazzaro / git-ci
Created September 10, 2024 13:37
A git script for quick continuous integration in an ensemble.
#!/bin/bash
MESSAGE=$1
pushd () {
command pushd "$@" > /dev/null
}
popd () {
command popd "$@" > /dev/null
@jonfazzaro
jonfazzaro / git-churn
Last active August 3, 2022 15:21 — forked from alanwillms/git-churn
See the top 10 most changed files in your repository.
#!/bin/bash
#
# Written by Corey Haines
# Scriptified by Gary Bernhardt: https://github.com/garybernhardt/dotfiles/blob/master/bin/git-churn
#
# Put this anywhere on your $PATH (~/bin is recommended). Then git will see it
# and you'll be able to do `git churn`.
#
# Show churn for whole repo:
# $ git churn
@jonfazzaro
jonfazzaro / swatch.sh
Created July 13, 2022 14:31
Do a thing when files change.
/usr/local/bin/fswatch -or -e ".git" -0 . | xargs -0 -n 1 -I {} /bin/zsh -c $1
@jonfazzaro
jonfazzaro / AwfullySpecificAndroidAssertions.kt
Created June 23, 2022 21:41
Use this assertion to test if a Kotlin class has a HiltViewModel annotation.
import org.junit.jupiter.api.Assertions.assertNotNull
inline fun <reified T : Any> assertIsHiltViewModel() {
assertNotNull(Class.forName("${T::class.qualifiedName}_HiltModules"))
}
class Verse:
def create(bottles):
return {
0: UltimateVerse(),
1: PenultimateVerse()
}.get(bottles, Verse(bottles))
def __init__(self, bottles):
self.bottles = bottles
@jonfazzaro
jonfazzaro / beer.py
Last active February 28, 2022 18:40
def number(bottles):
return str(bottles) if 0 < bottles else "No"
def bottlesOfBeer(bottles):
s = "" if bottles == 1 else "s"
return f"{number(bottles)} bottle{s} of beer"
def passOne(bottles):
@jonfazzaro
jonfazzaro / fan.ps1
Created June 28, 2018 12:32
A script for running multiple processes in parallel.
param(
[String[]] $Files,
[String] $Run
)
$processes = @()
foreach ($f in $Files) {
$processes += Start-Process -FilePath $Run -ArgumentList $f -PassThru
}
public class Encrypted {
public string Value { get; set; }
public string Salt { get; set; }
}
@jonfazzaro
jonfazzaro / InfernoEncryptionProvider.cs
Created September 27, 2016 16:08
You had one job, Inferno--make it so I didn't have to think about encryption.
using SecurityDriven.Inferno;
using System;
public class InfernoEncryptionProvider : IEncryptionProvider {
readonly IEncryptionConfiguration _configuration;
public InfernoEncryptionProvider(IEncryptionConfiguration configuration) {
_configuration = configuration;
}
@jonfazzaro
jonfazzaro / MemoryDbSet.cs
Last active August 22, 2016 16:46
In-memory implementation of IDbSet, for unit testing.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
public class MemoryDbSet<T> : IDbSet<T> where T : class {
readonly List<T> _list = new List<T>();