Skip to content

Instantly share code, notes, and snippets.

View astrieanna's full-sized avatar
working from home

Leah Hanson astrieanna

working from home
View GitHub Profile
astrieanna /
Created December 22, 2021 18:32
A series of exercises to develop an intuition for how scoping works in Python

Based on this version in Clojure

Lexical Scope in Python

Lexical scope guarantees that the reference to a value will be "enclosed" in the scope in which it is being used.

Lexical scoping simplifies our life because it allows us to mechanically follow code and determine where a value originated.

  • Start at the place of reference of the value
  • Then "walk" backwards and outwards to find where the value was defined
  • Now you know where the value came from
This file has been truncated, but you can view the full file.
[Envoy (Epoch 0)] [2020-06-18 22:07:26.052][23][debug][upstream] [external/envoy/source/common/upstream/] no healthy host for HTTP connection pool
[Envoy (Epoch 0)] [2020-06-18 22:07:26.076][6][debug][config] [external/envoy/source/common/config/] gRPC config for accepted with 1 resources with version 1592518045
[Envoy (Epoch 0)] [2020-06-18 22:07:26.076][6][trace][config] [external/envoy/source/common/config/] Sending DiscoveryRequest for version_info: "1592518045"
[Envoy (Epoch 0)] [2020-06-18 22:07:26.171][17][debug][upstream] [external/envoy/source/common/upstream/] no healthy host for HTTP connection pool
[Envoy (Epoch 0)] [2020-06-18 22:07:26.290][23][debug][upstream] [external/envoy/source/common/upstream/] no healthy host for HTTP connection pool
[Envoy (Epoch 0)] [2020
<script src=""></script>
<div id="container">
<!-- This element's contents will be replaced with your component. -->
astrieanna / test.jl
Created December 7, 2013 16:57
Trying to make `methodswith` work for a user-defined type.
module Test
export TwoVals, addtwovals
type TwoVals
function addtwovals(v::TwoVals)
v.val1 + v.val2
astrieanna / chart.jl
Last active December 22, 2015 00:49
Making Vega.jl plot
#Pkg.add for JSON
#Pkg.clone for Vega.jl, JSTypes
xs = open("xs.txt","r")
ys = open("ys.txt","r")
xarr = readdlm(xs)
yarr = readdlm(ys)
x2 = Float64[x for x in xarr]
y2 = Float64[y for y in yarr]
module Foo
export @timeof, @bench, BinaryTree, Node, Leaf, insert
macro timeof(expr)
t1 = time()
value = $(expr)
t2 = time()
configure: looking for configure programs
configure: found cmp
configure: found mkdir
configure: found printf
configure: found cut
configure: found grep
configure: found xargs
configure: found cp
configure: found find
configure: found uname
astrieanna / make.log
Last active December 15, 2015 05:59
Output of make on failed build of Servo.
make[1]: Entering directory `/home/leah/code/servo/build/src/pixman'
make all-recursive
make[2]: Entering directory `/home/leah/code/servo/build/src/pixman'
Making all in pixman
make[3]: Entering directory `/home/leah/code/servo/build/src/pixman/pixman'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/leah/code/servo/build/src/pixman/pixman'
Making all in demos
make[3]: Entering directory `/home/leah/code/servo/build/src/pixman/demos'
make[3]: Nothing to be done for `all'.
astrieanna /
Created March 20, 2013 16:27
A file that makes rustc have an internal error (task failed at 'Unsupported constant expr') and the backtrace log from the compiler. The file compile.log was created using `rustc --test &> compile.log`.
struct Level1<A> {
data : @mut [@A * 5]
, mut current : int
struct Level2<A> {
data : @mut [@Level1<A> * 32]
, mut current : int
astrieanna / freezes.jl
Created March 14, 2013 23:38
Socket code in Julia.
echo2_helper(socket,stat) =
c = accept(socket)
line = read_line(c)
while line != "0\n"