Skip to content

Instantly share code, notes, and snippets.

View akesling's full-sized avatar
🐣

Alex Kesling akesling

🐣
View GitHub Profile
class HelloPyForge:
def __call__(self, environ, start_response):
import json
response = json.dumps('Hello PyForge Gists!').encode('utf-8')
_write = start_response('200 OK', [
('Content-Type', 'application/json'),
('Content-Length', str(len(response)))
])
return [response]
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)
"""
{"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
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
$ 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 November 7, 2019 15:11
The output from trying to install diesel_cli with: cargo install diesel_cli --no-default-features --features mysql -v
$ 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
" 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)
" 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)
" 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 June 28, 2023 21:13
MNist loading helper for Python 2.7. For Python 3.x, see https://gist.github.com/akesling/42393ccb868125071fdea77d98a0d2f0
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