Skip to content

Instantly share code, notes, and snippets.

@yongqli
yongqli / zz-busybox-initramfs-fix
Last active May 2, 2019 03:47 — forked from HRomie/zz-busybox-initramfs-fix
Fix remote unlocking of LUKS-encrypted root in Ubuntu/Debian
#!/bin/sh
# This hook is for fixing busybox-initramfs issue while unlocking a luks
# encrypted rootfs. The problem is that the included busybox version
# is stripped down to the point that it breaks cryptroot-unlock script:
# https://bugs.launchpad.net/ubuntu/+source/busybox/+bug/1651818
# This is a non-aggressive fix based on the original busybox-initramfs hook
# until the bug is fixed.
# busybox or busybox-static package must be present for this to work
extern crate test;
#[derive(Debug)]
struct Mat4 {
dat: [[f64; 4]; 4]
}
macro_rules! dot{
($A:expr, $B:expr, $I:expr, $J:expr) => {
$A.dat[0][$I] * $B.dat[$J][0] +
RPROMPT="%F{yellow}[%D{%H:%M:%S}]%f"
strlen () {
FOO=$1
local zero='%([BSUbfksu]|([FB]|){*})'
LEN=${#${(S%%)FOO//$~zero/}}
echo $LEN
}
# show right prompt with date ONLY when command is executed
@yongqli
yongqli / Main.hs
Last active August 29, 2015 14:10
module Main where
import Text.Printf
import Data.List
import Data.Packed.Vector
import qualified Data.Packed.Vector as P
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Storable as S
import Numeric.LinearAlgebra.HMatrix hiding (udot)
% cabal install hmatrix --reinstall
Resolving dependencies...
In order, the following will be installed:
hmatrix-0.16.1.0 (new version)
hmatrix-gsl-0.16.0.2 (reinstall) changes: hmatrix-0.16.0.6 -> 0.16.1.0
Warning: Note that reinstalls are always dangerous. Continuing anyway...
Configuring hmatrix-0.16.1.0...
Building hmatrix-0.16.1.0...
Preprocessing library hmatrix-0.16.1.0...
[ 1 of 33] Compiling Data.Packed.Internal.Signatures ( src/Data/Packed/Internal/Signatures.hs, dist/dist-sandbox-e264f01/build/Data/Packed/Internal/Signatures.o )
@yongqli
yongqli / Main.hs
Last active August 29, 2015 14:10
module Main where
import Data.Random
import Control.Applicative
import Text.Printf
import Data.List
import Data.Packed.Vector
import qualified Data.Packed.Vector as P
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as U