Instantly share code, notes, and snippets.

View playme.sh
#!/usr/bin/env bash
# Copyright 2018 Ata Can Kuyumcu
# 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:
View fizzbuzz.fnl
(for [i 1 100]
(if (= 0 (% i 3))
(if (= 0 (% i 5))
(print "fizzbuzz")
(print "fizz"))
(= 0 (% i 5))
(print "buzz")
(print i)))
View keybase.md

Keybase proof

I hereby claim:

  • I am lvmbdv on github.
  • I am lvmbdv (https://keybase.io/lvmbdv) on keybase.
  • I have a public key ASBk2yrcxomHK-XTZX-ZH3lhC-mQ5dSeNW0MNSgaVUsrswo

To claim this, I am signing this object:

View thot.sh
#!/bin/bash
FUEL_COST=5
FOOD_COST=2
START_FUEL=50
START_FOOD=70
START_PARTS=2
START_CREW_SIZE=4
View bisection.py
#!/usr/bin/env python3
from sympy import lambdify
from itertools import count
n_decimal_digits = lambda value, n: format(value, ".%df" % (n+1))[:-1]
sign = lambda x: x / abs(x)
function = lambdify("x", input("Enter an expression to find a root for: "))
digit_target = int(input("Enter the number of digits to match: "))
View fixed-point-iteration.py
#!/usr/bin/env python3
from sympy import lambdify
from itertools import count
function = lambdify("x", input("Enter a method to iterate with: "))
initial_value = float(input("Enter the initial value for the iteration: "))
target_diff = float(input("Enter the target value for the difference between iterations: "))
value = initial_value
View euler2.clj
(defn fib
([] (fib 1 1)) ; start with x = y = 1
([x y] (lazy-seq (cons x (fib y (+ x y)))))) ; x = y and y = x + y
(println (reduce + (filter even?
(take-while #(< % 4000000) (fib)))))
View euler1.clj
(println (reduce +
(filter #(= (* (mod % 3) (mod % 5)) 0)
(range 1 1000))))
View euler2.cr
sum, x, y, z = 0, 1, 2, 3
while z <= 4000000
z = x + y
x = y
y = z
sum += z if z.divisible_by? 2
end
puts sum
View euler1.cr
sum = 0
(1..1000).each { |number|
if (number.divisible_by? 3) || (number.divisible_by? 5)
sum += number
end
}
puts sum