Skip to content

Instantly share code, notes, and snippets.

@lahwran
lahwran / gist:957fcd5b772cc11e79cc
Last active August 29, 2015 14:14
Hit `raw` to get a wrapped version.
Conversation about lifetimes on #rust, on mozilla's irc network,
prompted by hamnox and lahwran attempting to understand lifetimes.
Timestamps are in Mountain time.
1-30 07:09.06pm <lahwran> so we're reading this http://doc.rust-lang.org/book/ownership.html
1-30 07:09.28pm <lahwran> it mentions lifetimes a lot, and gives examples of where to use lifetimes, and the effects of lifetimes, but it has yet to actually, you know, describe what a lifetime is
1-30 07:09.48pm <theme> lahwran, I actually treat lifetimes as dependency markers
1-30 07:10.05pm <lahwran> we (my partner and I) have made several guesses as we read as to what lifetimes are, based on inference, but then we got to the point where a function used a lifetime both for an input and an output
1-30 07:10.06pm <Havvy> They're descriptions to how long a value lives.
@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.

#!/usr/bin/env python
import random
random = random.SystemRandom()
dictionary = open('/usr/share/dict/words', 'r').read().split()
dictionary = [w.lower() for w in dictionary if len(w) < 10]
# reasoning for these parameters:
# these two functions from github.com/lahwran/dotfiles:bin/summarize
import time
import hashlib
def iterfile(f, bufsize=None):
if not bufsize:
bufsize = 8192
while True:
buff = f.read(bufsize)
if not buff:
@lahwran
lahwran / gist:1916ef85f85962a79375
Created September 7, 2014 21:28
blacklist of activities that aren't allowed during pre-bedtime hours (because they can be used to uninstall the bedtime enforcer app)
package.manager.package/java.package.ClassName
com.android.packageinstaller/* // is the actual app uninstaller
com.android.settings/com.android.settings.Settings$ManageApplicationsActivity // slightly paranoid to ban this, but it's the list of installed apps
com.android.settings/com.android.settings.applications.InstalledAppDetails // details of an app - only placed that can force stop apps
com.android.settings/com.android.settings.ConfirmLockPassword // settings activity that can be used to remove the password lock
com.android.settings/com.android.settings.DeviceAdminAdd // settings activity that can be used to disable the device admin
com.estrongs.android.pop/* // ES file explorer (my main file browser
eu.chainfire.supersu/* // root control - easy to evade if I can get admin during the disallowed hours!
com.spartacusrex.spartacuside/* // local terminal
@lahwran
lahwran / books0.md
Last active November 2, 2016 14:03
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 / gist:d5edd23de23b93cb4e2b
Last active August 29, 2015 14:04
words that (probably) don't exist - but totally should
This file has been truncated, but you can view the full file.
1 '''chigh
1 '1properages
1 'abeltation
1 'abiet
1 'absors
1 'abya
1 'accells
1 'acceptu
1 'accoid
1 'acketter
Generating # words: 10000
rnnlm file: everyone-tokenized-model
<Bird|otherbox> josh: are you already seen dynamically insane languages types can get helping before it's ridiculous
<kosh> s/measles/right?/
<kosh> I don't know how to get fired because you are weird?
<kosh> I have time
<kosh> oompa one of the tech community are very hard to have been infuriating in noscript
<kosh> dw, fwiw I have all my sacrifice with a git book, prettymuch it per list, and there's no idea
<kosh> twinkies on Scheme effort' as an sdcard
<kosh> doing migrated a toy nrds days