lib/transfer_resolver.csv
:
10D,1,Signed to 10-Day Contract
10D2,2,Signed to Second 10-Day Contract
ABS,3,Leave of Absence
ACT,4,Activated
BRV,5,Placed on Bereavement List
CEXP,6,Contract Expired
CEXT,,Contract Extension
defmodule Capturepipe do | |
@doc """ | |
A pipe-operator that extends the normal pipe | |
in one tiny way: | |
It allows the syntax of having a bare `&1` capture | |
to exist inside a datastructure as one of the pipe results. | |
This is useful to insert the pipe's results into a datastructure | |
such as a tuple. |
defmodule Capturepipe do | |
@doc """ | |
A pipe-operator that extends the normal pipe | |
in one tiny way: | |
It allows the syntax of having a bare `&1` capture | |
to exist inside a datastructure as one of the pipe results. | |
This is useful to insert the pipe's results into a datastructure | |
such as a tuple. |
defmodule SteveTrollsElixir.Private do | |
defmacro __using__(_) do | |
quote do | |
import unquote(__MODULE__) | |
@on_definition {unquote(__MODULE__), :on_priv_def} | |
end | |
end | |
defmacro private() do | |
quote do |
lib/transfer_resolver.csv
:
10D,1,Signed to 10-Day Contract
10D2,2,Signed to Second 10-Day Contract
ABS,3,Leave of Absence
ACT,4,Activated
BRV,5,Placed on Bereavement List
CEXP,6,Contract Expired
CEXT,,Contract Extension
defmodule Decode do | |
@moduledoc """ | |
Extracted from https://github.com/ewildgoose/elixir-float_pp | |
""" | |
use Bitwise | |
@float_bias 1022 | |
############################################################################ |
#include <iostream> | |
#include <vector> | |
auto continuation = [](auto && val){return [=](auto && cont) { return cont(val);};}; | |
auto style = [](const auto &val) { return val; }; | |
auto mod = [](auto &&modv) { return [=](auto &&truecont){ return [=](auto &&falsecont) { return [=](auto &&val) { if (val % modv) { return truecont(val); } else { return falsecont(val); }; }; }; }; }; | |
auto passing = [](auto &&val) { return [=](auto &&cont){ return [=](auto &&) {return cont(val);};};}; | |
bool isLeapYear(int year){ | |
return (continuation) |
/* | |
* Date: 2018-11-26 | |
* Author of this C code: Wiebe-Marten Wijnja (Qqwy). | |
* Author of original JavaScript-version: Unknown. | |
* | |
* This version uses phase-accumulation to ensure that the signal remains continuous throughout, | |
* and that there are no nasty clicks when we change to the next note. | |
* You can add the directive `DISCONTINUOUS VERSION` (using e.g. the `-D` flag of `gcc` and `clang`) | |
* to compile it as the original version, that bases its samples only directly on the current sample, | |
* and therefore includes clicks whenever the note changes. |
import os | |
import sys | |
import argparse | |
from glob import glob | |
from itertools import chain | |
import fontforge | |
ADDITIONAL_LIGATURES = [ | |
'x.multiply', |
{-# LANGUAGE StaticPointers #-} | |
{-# LANGUAGE InstanceSigs #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
import Data.Binary | |
import System.IO.Unsafe | |
import GHC.StaticPtr |
In writing one’s own Base64 codec for the Cryptopals Crypto Challenge in Rust, one gets to a point where every chunk of four adjacent elements in an input vector has to be transformed into a chunk of three elements in an output vector.
That is, the string
SSdt
containing four ASCII bytes becomes the stringI'm
containing three ASCII bytes, andIGtp
becomeski
, and so on, so thatSSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t
is decoded toI'm killing your brain like a poisonous mushroom
.
I had a function to do this four-to-three downconversion but looping over the two arrays, lining up the indexes, the keeping track of magic threes and magic fours in my code gave me a headache as I worked through writing the following:
pub fn decode(s: &[u8]) -> Vec<u8> {
let mut out: Vec<u8> = vec![0; s.len() / 4 * 3];
for i in 0..ou