Skip to content

Instantly share code, notes, and snippets.

@tarruda
tarruda / nvim-terminal-edit.py
Last active September 4, 2020 05:32
Edit file in host Neovim instance from a :terminal buffer
#!/usr/bin/env python
"""Edit a file in the host nvim instance."""
import os
import sys
from neovim import attach
args = sys.argv[1:]
if not args:
print "Usage: {} <filename> ...".format(sys.argv[0])

2-13 12:15 <lahwran> how would one have an owned unknown-size non-resizeable array?
2-13 12:15 <reem> Box<[T]>
2-13 12:15 <lahwran> there's absolutely no way to have it on the stack?
2-13 12:15 <reem> Nope
2-13 12:15 <reem> There is no dynamic sizing on the stack right now

@lahwran
lahwran / pep20.md
Last active August 29, 2015 14:10
My edit/application of pep20. in the original form, pep20 might as well be scripture - these are transformations to it based on my experience, not based on arbitrary interpretation.

All of these are "as long as not at huge expense to the others"; any would be bad on their own.

(in machine-learning-nerd terms, read these as a series of objective functions, and evaluate code based on these as something approximately like the sum of squared errors function. In non-machine-learning-nerd terms, one should try to minimize how much code breaks each of these rules individually. They are not priority sorted.)

  • Beautiful is better than ugly - while this is hopefully obvious, looking better is an acceptable thing to aim for.

  • Explicit is better than implicit - only delegate to implicit things that are sufficiently common to not be confusing.

  • Simple is better than complex - do make things implicit that will be obvious anyway.

@lahwran
lahwran / books0.md
Last active October 1, 2024 04:54
Books

tuningmind's book list

tuningmind sent this in an irc pm to me (lahwran), formatted and categorized with tuningmind's permission. Comments in this section written by tuningmind.

  • Your Brain At Work by David Rock
    ^ that one really influenced my thinking a lot
    ^ recommend starting with this one
  • Mindset by Carol Dweck
  • So Good They Can't Ignore You: Why Skills Trump Passion in the Search for Meaningful Work by Cal Newport, one of my all time favorite bloggers
# to use:
# 1. put this file in ~/callstatement/callstatement.py
# 2. make a file ~/Library/Python/2.7/site-packages/derp.pth with this as the contents:
# "/Users/USER/callstatement/\nimport callstatement\n"
# 3. export PYTHONIOENCODING="callstatement_utf8"
# warning: EXTREMELY NASTY DO NOT USE IN PRODUCTION CODE
# WILL BREAK EVERYTHING I AM NOT RESPONSIBLE IF
# YOU'RE FOOLISH ENOUGH TO ACTUALLY TRY TO USE
# THIS
@lahwran
lahwran / gist:e63473d923cf6fbd2643
Last active December 26, 2017 04:27
words that have an abnormally high probability of being pronounceable and englishy, but low probability of being real
encognifie
pego
undlont
chrong
husses
simulatic
humfree
sungressionon
eqloich
seasure
@lahwran
lahwran / LICENSE-MIT.txt
Last active August 29, 2015 14:02
Little thing for doing d3 the angular way - declaratively. "declarative data driven documents"! (I'm not the first to make something like this)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
# data source:
# http://www.census.gov/genealogy/www/data/1990surnames/dist.male.first
# http://www.census.gov/genealogy/www/data/1990surnames/dist.female.first
from collections import namedtuple
n = namedtuple("n", "freq, index")
m = namedtuple("m", "delta, mindex, findex, mfreq, ffreq")
def df1(f1, f2):
return abs(f1 - f2)
@lahwran
lahwran / nltk_bot.py
Last active December 21, 2015 04:09
"""
To use:
1. Install virtualenv and pip - probably best done via your package manager:
sudo apt-get install python-pip python-virtualenv
2. `virtualenv stupidaibot`
3. `source stupidaibot/bin/activate`
4. save this file somewhere (if you haven't already)
@lahwran
lahwran / programmingresources.md
Last active November 19, 2018 19:46
Programming learning resources

This list was originally authored by a friend who has been learning programming for some time (tuningmind)

Programming learning resources

Note: Many books may be available from a nearby public library. Check there as well!

These two are about the best I've seen for starting from scratch: