I hereby claim:
- I am jasper-lyons on github.
- I am ioverthoughtthis (https://keybase.io/ioverthoughtthis) on keybase.
- I have a public key ASCZkHjo_13mJTFUaYGRLPVbSZtc6L8fGlKojMiNStCl_Ao
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
storage <- list() | |
numbers <- c(4, 1, 15, 12, 0, 9, 9, 5, 5, 8, 7, 3, 14, 5, 12, 3) | |
count <- 0 | |
while (!(list(numbers) %in% storage)) { | |
storage <- append(storage, list(numbers)) | |
largest <- max(numbers) | |
largestIndex <- which.max(numbers) | |
numbers[largestIndex] = 0 | |
index <- largestIndex |
data = (-10...10).map { |n| [n, n * 5] } | |
weight = 0 | |
30.times do | |
input, expected = data.sample # [[input, expected]] | |
output = weight * input | |
weight = weight - (expected - output) | |
puts([input, expected, output].inspect) | |
end |
#! /usr/bin/env guile -s !# | |
; guile needs the bash script comment closed | |
; saves an anonymous lambda later | |
(define inc (lambda (x) (+ x 1))) | |
; guiles list-set! function updates a list inplace but I want it to be immutable | |
; so I can use the old value from the list | |
(define (update-list lst index func) | |
(update-list-rec lst index func 0)) |
function onlyUniqueWords(string) { | |
return string.split(' ').reduce(function (arr, word) { | |
if (!arr) return arr; | |
if (arr.indexOf(word) > -1) return false; | |
return arr.concat(word); | |
}, []); | |
} | |
var passPhrases = `pphsv ojtou brvhsj cer ntfhlra udeh ccgtyzc zoyzmh jum lugbnk | |
... |
# got a huge ammount of help from https://stackoverflow.com/questions/11550153/determine-position-of-number-in-a-grid-of-numbers-centered-around-0-and-increasi | |
def sequence(i): | |
n = 2 * i - 1 | |
return n * n | |
def layer(i): | |
return math.floor((math.sqrt(i) + 1) / 2) | |
def length(i): |
function sheetChecksum (sheet) | |
local sum = 0 | |
for _, row in ipairs(sheet) do | |
local largest, smallest = 0, math.huge | |
for _, cell in ipairs(row) do | |
if cell > largest then largest = cell end | |
if cell < smallest then smallest = cell end | |
end |
def reverse_captcha(captcha) | |
(captcha + captcha[0]). # "21752...7422" | |
split(''). # ['2', '1', '7', ... '4', '2'] | |
each_cons(2). # [ ['2', '1'], ['1', '7'], ... ['4', '2'], ['2', '2'] ] | |
map { |a, b| a == b ? a.to_i : 0 }. # [0,0,0,0,0,...0,0,2] | |
reduce(&:+) # sum | |
end |
#! /bin/bash | |
while read oldrev newrev ref | |
do | |
# if we're on master branch | |
if [[ $ref =~ .*/master$ ]]; then | |
echo "Master ref received. Deploying master branch to production..." | |
git --work-tree=/srv/ageofai --git-dir=/home/git/ageofai checkout -f | |
source ~/.bash_profile | |
cd /srv/ageofai | |
if bundle install ; then |
require 'rom' | |
require 'rom-repository' | |
require 'byebug' | |
config = ROM::Configuration.new(:memory) | |
class Accounts < ROM::Relation[:memory] | |
register_as :accounts | |
end |