Skip to content
View flatten.ex
defmodule MyList do
def flatten([]), do: []
def flatten([head|tail]), do: concat (flatten head), (flatten tail)
def flatten(other), do: [other]
def concat([], list), do: list
def concat([head|tail], list), do: [head|(concat tail, list)]
def reverse(list), do: reverse list, []
def reverse([], reversed), do: reversed
View log_email_with_aws_lambda.js
'use strict';
// When selecting the fn, you have two ways to call it:
// "Event" - asynchronous invocation
// "RequestResponse" - Logs the return value (maybe does more, but it cares about the return value, at the very least)
exports.handler = (event, context, callback) => {
/*
event:
{ Records: [{eventSource: 'aws:ses', eventVersion: '1.0', ses: <EMAIL>}]}
https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html
View mini_sinatra.rb
# Started to write a mini Sinatra for a thing
# then just realized I should use Sinatra, so I stopped doing it
# but figured it might be interesting enough to keep around
class WebFramework
class Request
attr_accessor :env, :status_code, :headers, :body
def initialize(env)
self.env = env
end
View refactor_this.rb
# Recreating the context of the image in https://medium.freecodecamp.com/360-million-reasons-to-destroy-all-passwords-9a100b2b5001#.9im7lyumv
# in case I ever want to write a "here's how you should refactor this code" blog or something
require 'active_record'
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
ActiveRecord::Schema.define do
self.verbose = false
create_table :users do |t|
t.string :user_name
t.string :email
View iterm2_inline_images.fish
# this works in Fish, prob works in Bash too, I didn't try it
# you'll probably need to install the chunky_png gem: `gem install chunky_png`
# docs: http://iterm2.com/documentation-images.html
# video: https://vimeo.com/170123782
ruby -r chunky_png -r base64 -e '
radius = 100
num_points = 200
magnitude_delta = 0.1
white = ChunkyPNG::Color.rgb 0xFF, 0xFF, 0xFF
View quantum_computers.txt
A qubit is a "quantum bit"
normal bits can have one of two states, lets say 0 and 1
qubits, when measured, will also be in one of those two states
But *before being measured, THEY ARE IN BOTH STATES*, this is called "superposition"
(possibly, they are in some probability of both states rather than fully in them both,
I'd test this by coercing the double slit experiment so that its more likely to go through
one slit than the other, and expect the interference pattern to change accordingly)
Going from both states to one state is called "collapsing" it
Qubits implemented through things like electron "spin"
Spin is actually just magnetic orientation (pretty sure)
View mithm.txt
Note 1:
"cpez" represents an encrypted body bc
"cpez" == "body".chars.map(&:succ).join
Note 2:
:80 means "port 80", ie HTTP
:443 means "port 443", ie HTTPS
SSL Strip (I think):
Browser MitM Server
View SameTypeAndConstructor.elm
-- An example of how to have a constructor and type with the same name
-- https://github.com/elm-lang/core/blob/3833b53f57f21df7ce7d3cf6664c61ee5671df4b/src/Task.elm#L43-L52
import Html exposing (Html, button, div, text)
import Html.App as Html
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
main =
Html.beginnerProgram { model = initialCount, view = view, update = update }
View Xtreme_Kit_Instructions.pdf
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View additional_cone.md

Lets say there's a new cone that detects ultraviolet light, represented here with U. Really, I think this would work with any frequency, I'm just picking ultraviolet b/c it's outside the range we can currently see, so its easier to understand it as a new colour. But in reality, it might have difficulty making it down to the retina, based on some things I was reading, so don't get too caught up on the U, it's a thought experiment.

Then we have these cones: R G B U

This gives us 8 new colours that we cannot currently see!

These are the combinations they could fire in, asterisk means that this colour is new, we've never seen it before:

R | G | B | U | Description
Something went wrong with that request. Please try again.