I hereby claim:
- I am abresas on github.
- I am abresas (https://keybase.io/abresas) on keybase.
- I have a public key ASC0TimJoVHRPZDEVK_LVcBU6ZR-1Da1rCsfsTDxfVANIQo
To claim this, I am signing this object:
{ | |
"coc.preferences.formatOnSaveFiletypes": ["go"], | |
"coc.preferences.diagnostic.infoSign": "ℹ", | |
"coc.preferences.diagnostic.hintSign": "ℹ", | |
"languageserver": { | |
"golang": { | |
"command": "gopls", | |
"rootPatterns": ["go.mod"], | |
"filetypes": ["go"] | |
} |
module Amicable2 where | |
d :: Int -> Int | |
d x = sum [n | n <- [1 .. (x `div` 2)], x `mod` n == 0] | |
(===) :: (Eq b) => (a -> b) -> (a -> b) -> a -> Bool | |
(f === g) x = f x == g x | |
(/==) :: (Eq b) => (a -> b) -> (a -> b) -> a -> Bool | |
(f /== g) x = f x /= g x |
module Amicable where | |
d :: Int -> Int | |
d x = sum [n | n <- [1 .. (x `div` 2)], x `mod` n == 0] | |
amicable :: Int -> Bool | |
amicable a = d a /= a && (d . d) a == a | |
main = print $ sum $ filter amicable [1 .. 9999] |
var range = function (a, b) { return function*() { for (var i = a; i <= b; ++i) { yield i; } } }; | |
var map = function (m, f) { return function*() { for (let i of m()) { yield f(i); } } }; | |
var foreach = function (m, f) { for (let i of m()) { f(i); } }; | |
var head = function (m) { for (let i of m()) { return i; } }; | |
var tail = function (m) { return function*() { var first = true; for (let i of m()) { if (!first) { yield i; } first = false; } }; }; | |
var isEmpty = function(m) { var r = true; for (let i of m()) { r = false; } return r; } | |
var reverse = function(m) { return function*() { if (!isEmpty(m)) { for (let i of reverse(tail(m))()) { yield i; } yield head(m); } } }; | |
foreach(reverse(map(range(1,10), function(i) { return i*i; })), console.log); |
I hereby claim:
To claim this, I am signing this object:
from random import random | |
from sys import exit | |
value = 100 | |
steps = 0 | |
while True: | |
steps += 1 | |
if random() < 0.51: | |
value *= 0.9 | |
else: |
<?php | |
// returns a timezone that is at the given offset | |
// taking into consideration if the timezone | |
// is currently observing DST or not. | |
// | |
// offset: timezone offset in seconds | |
function tz_from_offset($offset) { | |
$tz = timezone_name_from_abbr(0, $offset, 0); | |
$date = date_create("now", new DateTimeZone($tz)); | |
if ($date->getOffset() != $offset) { |