Put flip
somewhere in your $PATH
and chmod a+x
it.
Copy fuck
into ~/.bashrc
.
/* | |
[DESAFIO / LANGUAGE WAR] Implemente um programa na sua linguagem favorita onde o usuário digita um número x, e o programa calcula o somatório dos x primeiros números pares da sequência fibonacci, e imprime a soma dos algarismos desse número. | |
Por exemplo, quando x = 5, a resposta é 17, pois: | |
1. A sequência fibonacci é 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233,... | |
2. Os 5 primeiros números pares são 0, 2, 8 e 34, 144. | |
3. O somatório disso é 188. | |
4. Somando os algarismos, 1+8+8 = 17 |
module Fib using: Platform where | |
open Platform Prelude expose [+, parse, as-string, ~] | |
open Platform List expose [zip:using:, map:, take:, filter:, sum] | |
open Platform IO expose [read-line, print] | |
-- Typing things is currently cumbersome, but the type inference algorithm should catch 90% of this | |
let (Num a) => String -> a :: | |
x as-number = x parse |
function defmulti(keyfn) | |
if not keyfn then | |
keyfn = function(...) return ... end | |
end | |
local multi = { | |
_keyfn = keyfn, | |
_methods = {} | |
} | |
setmetatable(multi, { | |
__call = function(self, ...) |
Now that we live in the Big Data, Web 3.14159 era, lots of people want to build databases that are too big to fit on a single machine. But there's a problem in the form of the CAP theorem, which states that if your network ever partitions (a machine goes down, or part of the network loses its connection to the rest) then you can keep consistency (all machines return the same answer to
Not all random values are created equal - for security-related code, you need a specific kind of random value.
A summary of this article, if you don't want to read the entire thing:
Math.random()
. There are extremely few cases where Math.random()
is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.crypto.getRandomBytes
directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.uuid
, specifically the uuid.v4()
method. Avoid node-uuid
- it's not the same package, and doesn't produce reliably secure random values.random-number-csprng
.You should seriously consider reading the entire article, though - it's
LOVE_BIN=/usr/bin/love | |
LOVE_DIR=./src/love | |
DIST_DIR=./src/dist | |
PATCH_DIR=./src/patch | |
BUILD_DIR=./build | |
BIN_DIR=./bin | |
LOVE_VERSION=0.9.1 | |
GAME_NAME=MySampleGame | |
PRETTY_NAME=My Sample Game |
Digital cryptography! This is a subject I've been interested in since taking a class with Prof. Fred Schneider back in college. Articles pop up on Hacker News fairly often that pique my interest and this technique is the result of one of them.
Specifically, this is about Lamport signatures. There are many signature algorithms (ECDSA and RSA are the most commonly used) but Lamport signatures are unique because they are formed using a hash function. Many cryptographers believe that this makes them resistant to attacks made possible by quantum computers.
function hashCrypt(key, plain, hasher, workFactor=1) { // hasher is any sync string-output hash function | |
var len=plain.length, keyLen = key.length, keyOrig = key, | |
// calculate derivation count based on deterministic factors from the inputs: | |
mx = hasher(key).split("").map((a, b)=> a.charCodeAt(0) + b).reduce((a, b)=> a + b, 0) * workFactor; | |
// derive firstly for some hardness using cpu and ram hungry calculations: | |
for(let i = 0; i < mx; i++) key = hasher(key.repeat( ((i+len) % ((workFactor || 1) * 4))+1 )); | |
// expand key to needed length by appending re-hashing (with counters): |
I start with a list and plan to create a comparison table.
http://www.w3.org/TR/WebCryptoAPI/
This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.