Skip to content

Instantly share code, notes, and snippets.

Три продавца продают куриц.
У первого их 10, у второго - 16, у третьего - 26.
Первую половину дня они продавали куриц по одной цене.
Вторую половину дня они продавали куриц по пониженной цене.
В конце дня они продали всех куриц и каждый получил 35 долларов.
По какой цене они продавали куриц?
Курицы продаются целыми, цены не могут дробиться меньше цента.
// FizzBuzz in pure lambda notation
// transcribed from http://codon.com/programming-with-nothing
// props to http://community.bartdesmet.net/blogs/bart/archive/2009/08/17/mis-using-c-4-0-dynamic-type-free-lambda-calculus-church-numerals-and-more.aspx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
import qualified Data.Foldable as Foldable
import qualified Data.Maybe as Maybe
fizzBuzz x =
Maybe.fromMaybe (show x) (Foldable.fold $ map fbInclude [(3, "Fizz"), (5, "Buzz")])
where fbInclude (n, msg) = if x `mod` n == 0 then Maybe.Just msg else Maybe.Nothing
main = Foldable.forM_ [1..100] (putStrLn . fizzBuzz)
@m1el
m1el / cross.hs
Last active August 29, 2015 14:13
draw a cross of a given size in terminal
import System.Environment
import Text.Read
import Data.Either
cross :: Int -> String
cross n = do
row <- [0..n-1]
col <- [0..n]
return $ charAt row col
where
// wrap first text letter of an element with a span having a specified class
// red letter
// License=WTFPLv2
function redLetterize(element, cls) {
cls = cls === undefined ? 'first-letter-wrapped' : ('' + cls).replace(/^\s+|\s+$/g, '');
while (element.firstChild && element.firstChild.tagName) {
if ((' ' + element.firstChild.className + ' ').indexOf(' ' + cls + ' ') > -1) {
return;
}
element = element.firstChild;
// factorial in point-fre notation
// factorial churc encoding
console.log(((function (f) {
return (function (x) {
return f(function (y) {
return x(x)(y);
});
})(function (x) {
return f(function (y) {
return x(x)(y);
import Data.Maybe
import Control.Monad
newtype NonNeg = NonNeg { unNonNeg :: Maybe Integer }
liftNN :: (Integer -> Integer) -> (NonNeg -> NonNeg)
liftNN fn a = NonNeg $ (liftM fn) (unNonNeg a)
liftNN2 :: (Integer -> Integer -> Integer) -> (NonNeg -> NonNeg -> NonNeg)
liftNN2 fn a b = NonNeg $ (liftM2 fn) (unNonNeg a) (unNonNeg b)
# diff debian/list.txt debian2/list.txt
5a6
> cdebootstrap-helper-rc.d install
9d9
< debconf-i18n install
35d34
< liblocale-gettext-perl install
51,53d49
< libtext-charwidth-perl install
< libtext-iconv-perl install
# powershell template templates templating
$vars = @{ "a"=1; "b"=2; "c"=3 }
[RegEx]::Replace('a: $<a>, b: $<b>, c: $<c>', '\$<(\w+)>', { param($m); $vars[$m.Groups[1].Value]; })
@m1el
m1el / ru.md
Last active August 29, 2015 14:16 — forked from Izumi-kun/ru.md

Description

The first BSOD (0x00000139) occured this year January 2 and never happened before.

After core dump analysis I came to conclusion that this error happens because because of a network adapter.

January 4 after a BSOD during the night I tried to manually reproduce this error.

Experimentally, I found out the moment the error occurs - Computer maintenance Screnshot 3.

Error dates can be found on Screenshot 1.