Skip to content

Instantly share code, notes, and snippets.

Chris Granade cgranade

Block or report user

Report or block cgranade

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
cgranade / Dockerfile
Last active Jul 9, 2019
Using Q# from Python
View Dockerfile
# The same image used by
# Add metadata indicating that this image is used for the katas.
# Make sure the contents of our repo are in ${HOME}
# Required for
USER root
cgranade / Dockerfile
Last active Mar 6, 2019
View Dockerfile
FROM jupyter/minimal-notebook:7f1482f5a136
cgranade / QSharpCmdlets.cs
Last active Dec 3, 2018
Getting PoSh with Q#
View QSharpCmdlets.cs
using System;
using System.Linq;
// This namespace provides the API that we need to implement
// to interact with PowerShell.
using System.Management.Automation;
// This namespace provides the target machine that we will use to run our Q#
// code.
using Microsoft.Quantum.Simulation.Simulators;
View gist:bb6079fbbd5c1dac4e51775bd4834f89
As well as anything can be known, she knew three things about the world.
The first was the difference between syntax and semantics.
Syntax is that which can be named, reasoned about, understood, and reduced to its most fundamental form.
Semantics, on the other hand, is the domain of that which cannot be understood merely as the sum of its constituent tokens, but which must be understood as a whole — that which defies reduction.
Though as different as form and function, as void and vacuum, together syntax and semantics make everything around us.
The sunrise is beautiful not wholly because of semantics, but because we have a syntax to express that which happens every day, that which revolves around us, that which recurs into time immortal and yet has a quality beyond that mere quality.
This distinction, of course, is familiar not only to linguists who study how we convey meaning to others, but also to the programmers who cast magic (but I am ahead of myself here).
Keats' rainbow was not merely unwoven, but dec
cgranade / Get-PackageReferences.ps1
Created Jul 10, 2018
Return a list of NuGet package references for all C# projects in a folder.
View Get-PackageReferences.ps1
Get-ChildItem -Recurse *.csproj -PipelineVariable project `
| Select-Xml -XPath //PackageReference `
| ForEach-Object { [pscustomobject]@{ "Name" = $_.Node.Include; "Version" = $_.Node.Version } } `
| Group-Object { $project} `
| Format-List
View Delete-Duplicates.ps1
SupportsShouldProcess = $true,
ConfirmImpact = "High"
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 /
Created Jun 6, 2017
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/\"
# and the following .gitattributes:
# *.bib diff=bibtex
# Have fun!
cgranade / Confirm-Citations.ps1
Last active Mar 27, 2017
Check a BibTeX bibliography to make sure everything is properly linked (DOI, ISBN or arXiv).
View Confirm-Citations.ps1
ipmo posh-tex
function ConvertFrom-BibTeX {
[string] $Path
$bibDB = Invoke-Python @"
import bibtexparser
import json
cgranade /
Created Jan 23, 2017 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 as sio
import json
def transform_data(data):
if isinstance(data, dict):
You can’t perform that action at this time.