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
{-# LANGUAGE StaticPointers #-} | |
{-# LANGUAGE InstanceSigs #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
import Data.Binary | |
import System.IO.Unsafe | |
import GHC.StaticPtr |
{-# LANGUAGE QuasiQuotes, TemplateHaskell, ScopedTypeVariables #-} | |
module BakedVector where | |
import qualified Data.ByteString.Lazy as BSL | |
import Data.ByteString.Lazy (unpack) | |
import Data.ByteString.Builder (toLazyByteString) | |
import Data.ByteString.Builder.Prim | |
import Foreign.Storable | |
import qualified Data.Vector.Storable as VS |
{:beam_file, Addition, | |
[ | |
{:__info__, 1, 2}, | |
{:"__type_check_spec_for_add/2__", 0, 18}, | |
{:add, 2, 8}, | |
{:baseline_add, 2, 16}, | |
{:module_info, 0, 20}, | |
{:module_info, 1, 22} | |
], [vsn: [337339698024769425821845159222917769638]], | |
[ |
# Downloaded from: https://gist.github.com/eksperimental/55f1e207ab5878a668668546f57a3f90 | |
# | |
# Lists all the types that have the problem reported in | |
# https://github.com/elixir-lang/elixir/issues/10140 | |
# create an Elixir project, and save this file in lib/typespec_example.ex | |
# Start IEx with: iex -S mix | |
# then run: TypespecExample.types() | |
# and paste the output into the shell. | |
defmodule TypespecExample do |
#include <cassert> | |
#include <iostream> | |
template<typename T, typename R=void> | |
struct ExtMethod { | |
ExtMethod& operator - () { | |
return *this; | |
} | |
template<typename U> |
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. |
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 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 |
import os | |
import sys | |
import argparse | |
from glob import glob | |
from itertools import chain | |
import fontforge | |
ADDITIONAL_LIGATURES = [ | |
'x.multiply', |
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