Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Kesling akesling

View GitHub Profile
View mnist.py
import os
import struct
import numpy as np
"""
Loosely inspired by http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py
which is GPL licensed.
Last tested on Python 3.9 (2022-08-11)
"""
View CustomLayout1.json
{"keymaps":[[{"code":20,"label":{"base":"q","shifted":"Q"}},{"code":26,"label":{"base":"w","shifted":"W"}},{"code":8,"label":{"base":"e","shifted":"E"}},{"code":21,"label":{"base":"r","shifted":"R"}},{"code":23,"label":{"base":"t","shifted":"T"}},{"code":0,"label":{"base":{"full":"Blocked","1u":"Blkd"}},"categories":["blanks"]},{"code":0,"label":{"base":{"full":"Blocked","1u":"Blkd"}},"categories":["blanks"]},{"code":28,"label":{"base":"y","shifted":"Y"}},{"code":24,"label":{"base":"u","shifted":"U"}},{"code":12,"label":{"base":"i","shifted":"I"}},{"code":18,"label":{"base":"o","shifted":"O"}},{"code":19,"label":{"base":"p","shifted":"P"}},{"code":4,"label":{"base":"a","shifted":"A"}},{"code":22,"label":{"base":"s","shifted":"S"}},{"code":7,"label":{"base":"d","shifted":"D"}},{"code":9,"label":{"base":"f","shifted":"F"}},{"code":10,"label":{"base":"g","shifted":"G"}},{"code":0,"label":{"base":{"full":"Blocked","1u":"Blkd"}},"categories":["blanks"]},{"code":0,"label":{"base":{"full":"Blocked","1u":"Blkd"}},"ca
View clippy.out
Checking rimd v0.0.2 (/Users/akesling/Devel/FallenTimbre/rimd)
warning: use of deprecated macro `try`: use the `?` operator instead
--> src/midi.rs:194:29
|
194 | 1 => { ret.push(try!(read_byte(reader))); }
| ^^^
|
= note: `#[warn(deprecated)]` on by default
warning: use of deprecated macro `try`: use the `?` operator instead
View gist:4f1e026d17aa6376ce3213e79c8902b3
$ cargo build
Compiling foo v0.1.0 (/Users/akesling/Devel/rust/tonic-break/foobar)
error[E0428]: the name `client` is defined multiple times
--> /Users/akesling/Devel/rust/tonic-break/foobar/target/debug/build/foo-f7fc2b277b67ed62/out/example.foobar.v1.rs:89:1
|
17 | pub mod client {
| -------------- previous definition of the module `client` here
...
89 | pub mod client {
| ^^^^^^^^^^^^^^ `client` redefined here
@akesling
akesling / diesel_cli_install_output
Created Nov 7, 2019
The output from trying to install diesel_cli with: cargo install diesel_cli --no-default-features --features mysql -v
View diesel_cli_install_output
$ cargo install diesel_cli --no-default-features --features mysql -v
Updating crates.io index
Installing diesel_cli v1.4.0
Compiling maybe-uninit v2.0.0
Compiling libc v0.2.65
Compiling proc-macro2 v1.0.6
Compiling cc v1.0.47
Compiling getrandom v0.1.13
Compiling unicode-xid v0.2.0
Compiling cfg-if v0.1.10
View ondemandhighlight.vim
" Highlight a word from inside vim. The color is chosen at random but
" persisted across sessions.
" By Kartik Agaram -- http://akkartik.name -- ondemandhighlight@akkartik.com
" Experimenting with an idea by Evan Brooks: https://medium.com/p/3a6db2743a1e
" Discussion: http://www.reddit.com/r/programming/comments/1w76um/coding_in_color
let highlight_file = &viewdir."/highlights"
if !filereadable(highlight_file)
call system("mkdir -p ".&viewdir)
View ondemandhighlight.vim
" Highlight a word from inside vim. The color is chosen at random but
" persisted across sessions.
" By Kartik Agaram -- http://akkartik.name -- ondemandhighlight@akkartik.com
" Experimenting with an idea by Evan Brooks: https://medium.com/p/3a6db2743a1e
" Discussion: http://www.reddit.com/r/programming/comments/1w76um/coding_in_color
let highlight_file = &viewdir."/highlights"
if !filereadable(highlight_file)
call system("mkdir -p ".&viewdir)
View ondemandhighlight.vim
" Highlight a word from inside vim. The color is chosen at random but
" persisted across sessions.
" By Kartik Agaram -- http://akkartik.name -- ondemandhighlight@akkartik.com
" Experimenting with an idea by Evan Brooks: https://medium.com/p/3a6db2743a1e
" Discussion: http://www.reddit.com/r/programming/comments/1w76um/coding_in_color
let highlight_file = &viewdir."/highlights"
if !filereadable(highlight_file)
call system("mkdir -p ".&viewdir)
@akesling
akesling / mnist.py
Last active Aug 11, 2022
MNist loading helper for Python 2.7. For Python 3.x, see https://gist.github.com/akesling/42393ccb868125071fdea77d98a0d2f0
View mnist.py
import os
import struct
import numpy as np
"""
MNist loading helper for Python 2.7.
For Python 3.x, see https://gist.github.com/akesling/42393ccb868125071fdea77d98a0d2f0
Loosely inspired by http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py
View mnist.py
import os, struct
from array import array
from cvxopt.base import matrix
def read(digits, dataset = "training", path = "."):
"""
Python function for importing the MNIST data set.
"""
if dataset is "training":