Skip to content

Instantly share code, notes, and snippets.

View cgranade's full-sized avatar

Cassandra Granade cgranade

View GitHub Profile
@cgranade
cgranade / Get-PackageReferences.ps1
Created July 10, 2018 20:56
Return a list of NuGet package references for all C# projects in a folder.
Get-ChildItem -Recurse *.csproj -PipelineVariable project `
| Select-Xml -XPath //PackageReference `
| ForEach-Object { [pscustomobject]@{ "Name" = $_.Node.Include; "Version" = $_.Node.Version } } `
| Group-Object { $project} `
| Format-List
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "High"
)]
param(
[string]
$GoodDirectory,
[string]
$TargetDirectory
import sys
import numpy as np
from PIL import Image
from PIL.ImageEnhance import Contrast
from PIL.ImageOps import invert
from io import BytesIO
from functools import partial
from toolz import compose
def pil_pipeline_step(fn):
@cgranade
cgranade / pprint_bibtex.py
Created June 6, 2017 08:34
BibTeX textconv plugin for Git
# 2017 Christopher Granade. This is a silly experiment, so I am placing it
# in the public domain. No rights reserved.
# Use with the following .gitconfig:
# [diff "bibtex"]
# textconv=python \"path/to/pprint_bibtex.py\"
# and the following .gitattributes:
# *.bib diff=bibtex
# Have fun!
@cgranade
cgranade / Confirm-Citations.ps1
Last active March 27, 2017 06:01
Check a BibTeX bibliography to make sure everything is properly linked (DOI, ISBN or arXiv).
ipmo posh-tex
function ConvertFrom-BibTeX {
param(
[string] $Path
)
$bibDB = Invoke-Python @"
import bibtexparser
import json
@cgranade
cgranade / maton.py
Created January 23, 2017 19:46
maton.py: Dump MATLAB files to JSON for using with basically anything else.
#!/usr/bin/env python
from __future__ import division, print_function
import click
import numpy as np
import scipy.io as sio
import json
def transform_data(data):
if isinstance(data, dict):
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.