Skip to content

Instantly share code, notes, and snippets.

Matt Bauman mbauman

View GitHub Profile
View find_first_nan.jl
using Cassette, ReplMaker
Cassette.@context NoNaN
nonnan(s, x::Number) = (@assert(!isnan(x), string(s, " returned NaN")); x)
nonnan(s, A::AbstractArray) = (foreach(x->nonnan(s, x), A); A)
nonnan(s, x) = x
Cassette.overdub(::NoNaN, f, args...) = nonnan("$f$args", f(args...))
@mbauman
mbauman / MatlabClasses.ipynb
Last active May 29, 2020
Documenting how to parse Matlab's opaque class structure for MAT files with Julia.
View MatlabClasses.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mbauman
mbauman / DiscourseStats.jl
Last active Mar 2, 2020
Cumulative discourse stats
View DiscourseStats.jl
using HTTP, JSON, DataFrames, Dates, CSV
function cumulative(dates)
start_date = Dates.format(minimum(dates)-step(dates), "YYYY-mm-dd")
end_date = Dates.format(maximum(dates), "YYYY-mm-dd")
colnames = []
cols = []
for report in ("signups", "posts", "likes", "page_view_total_reqs", "topics")
r = HTTP.get("https://discourse.julialang.org/admin/reports/$report.json?end_date=$end_date&start_date=$start_date",
["Api-Key"=> ENV["JULIA_DISCOURSE_API_KEY"], "Api-Username"=> ENV["JULIA_DISCOURSE_USERNAME"]])
@mbauman
mbauman / mac-bash-completion.patch
Created Feb 23, 2011
A patch to bash-completion version 1.3 (http://bash-completion.alioth.debian.org/). Adds completions for Mac OS X specific utilities: defaults, launchctl, open, and xcodebuild. Additionally, it properly enables killall.
View mac-bash-completion.patch
diff -Naur bash-completion-1.3/completions/Makefile.am bash-completion-1.3-mac/completions/Makefile.am
--- bash-completion-1.3/completions/Makefile.am 2011-01-21 04:36:11.000000000 -0500
+++ bash-completion-1.3-mac/completions/Makefile.am 2011-02-22 22:02:25.000000000 -0500
@@ -33,6 +33,7 @@
cvs \
cvsps \
dd \
+ defaults \
dhclient \
dict \
View Manifest.toml
# This file is machine-generated - editing it directly is not advised
[[AbstractFFTs]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "380e36c66edfa099cd90116b24c1ce8cafccac40"
uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c"
version = "0.4.1"
[[Arpack]]
deps = ["BinaryProvider", "Libdl", "LinearAlgebra"]
View Revise LinearAlgebra
$ ./julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.3.0-alpha.148 (2019-08-16)
_/ |\__'_|_|_|\__'_| | Commit b5f4e87774 (3 days old master)
|__/ |
View DefaultKeyBinding.dict
{
/* Ctrl shortcuts from Emacs */
"^l" = "centerSelectionInVisibleArea:"; /* C-l Recenter */
"^/" = "undo:"; /* C-/ Undo */
"^_" = "undo:"; /* C-_ Undo */
"^ " = "setMark:"; /* C-Spc Set mark */
"^\@" = "setMark:"; /* C-@ Set mark */
/* "^w" = "deleteToMark:"; /* C-w Delete to mark */
/* TextMate-like addenda */
View arraytraits.md

Status quo

Currently the AbstractArray type hierarchy has three major subtype trees:

  • DenseArray
  • AbstractSparseArray
  • AbstractRange

In addition, we have the StridedArray typealias, which effectively “adds” strided SubArrays and ReshapedArrays as pseudo-subtypes of DenseArrays.

We also have the IndexStyle trait.

View broadcaststyle-deprecation.diff
diff --git a/base/broadcast.jl b/base/broadcast.jl
index 95a25bed66..7c0fa71aba 100644
--- a/base/broadcast.jl
+++ b/base/broadcast.jl
@@ -97,9 +97,13 @@ struct DefaultArrayStyle{N} <: AbstractArrayStyle{N} end
(::Type{<:DefaultArrayStyle})(::Val{N}) where N = DefaultArrayStyle{N}()
const DefaultVectorStyle = DefaultArrayStyle{1}
const DefaultMatrixStyle = DefaultArrayStyle{2}
-BroadcastStyle(::AbstractArray{T,N}) where {T,N} = DefaultArrayStyle{N}()
+BroadcastStyle(v::AbstractArray{T,N}) where {T,N} = _broadcast_api_deprecation(DefaultArrayStyle{N}(), BroadcastStyle(typeof(v)))
View missingdocs.jl
julia> function searchdocs(mod, seen=Set())
mod in seen && return
push!(seen, mod)
for name in names(mod)
isdefined(mod, name) || continue
Base.isdeprecated(mod, name) && continue
b = getfield(mod, name)
docs = Base.Docs.doc(b)
if startswith(string(docs), "No documentation found")
println(mod, ".", name)
You can’t perform that action at this time.