dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress oflag=sync
loadkeys <your-keymap>
Lazy, infinite recursive sequences in Bash (like in Haskell, if you squint). | |
I was inspired by the beautiful Haskell zipWith implementation of the Fibonacci sequence `fibs = 0 : 1 : zipWith (+) fibs (tail fibs)` | |
to find an equivalent in bash using 'coroutines' and recursive pipes. | |
My original experiments were https://twitter.com/tavisrudd/status/367164339716751360 | |
"fun w/ recursive pipes: e=echo;mkfifo fib;{ $e 0 1 1 >fib &};{ while read i j k; do $e $i >&2; $e $j $k $(($j+$k));sleep .4; done;}<fib>fib" | |
and https://twitter.com/tavisrudd/status/367142071489937408 | |
"o=ouro;b=boros;mkfifo $o$b;e=echo; { $e $o > $o$b & }; { while read s;do $e $s>&2;case $s in $o)$e $b;;*)$e $o; esac; done; }<$o$b >$o$b" |
(defun remote-shell-fav-hosts-get () | |
"My hook to the remote-shell processes in order to connect to | |
my OpenStack controller, and create a hashtable of host names as | |
the keys, and IP addresses as the values." | |
(interactive) | |
;; Run nova list command remotely on this host system, and put the | |
;; results in a temp buffer: | |
(let* ((undercloud-controller "10.98.1.145") | |
(default-directory (format "/ssh:%s:" undercloud-controller)) |
(ns ^{:doc "Evaluator from ch1 of lisp in small pieces. Warning: | |
NON-IDIOMATIC clojure!"} | |
lisp.chapter1.eval | |
(:refer-clojure :exclude [extend])) | |
(defn wrong [& msgs] | |
(throw (RuntimeException. (apply str msgs)))) | |
;; -- runtime support, environments are represented as a seq of pairs, | |
;; -- stored in an atom. Non-idiomatic but faithful to the book. |
#lang racket | |
;; A solver for the following puzzle: | |
;; Given 5 integers a, b, c, d, and e, | |
;; find an expression that combines a, b, c, and d with arithmetic operations (+, -, *, and /) to get e. | |
(require srfi/1) | |
(define ops '(+ - * /)) |
(* | |
This script analyzes the dependencies between top level types in a .NET Assembly. | |
It is then used to compare the dependency relationships in some F# projects with those in some C# projects. | |
Note that no attempt has been made to optimize the code yet! | |
REQUIRES: | |
* Mono.Cecil for code analysis | |
From http://www.mono-project.com/Cecil#Download |
Require Import Coq.Program.Basics. | |
Require Import Coq.Program.Syntax. | |
Require Import Coq.Init.Datatypes. | |
Require Import Coq.Unicode.Utf8. | |
Open Local Scope program_scope. | |
Open Local Scope list_scope. | |
Open Local Scope type_scope. | |
Class Functor (φ : Type → Type) := { |
# This entry boots an Antergos (Arch) Linux ISO straight from disk. | |
# LVM is not supported because the lvm module is not loaded in Antergos initrd | |
menuentry "Antergos Minimal ISO 2015-09-13" { | |
insmod part_gpt | |
insmod lvm | |
insmod loopback | |
set root=(hd0,0) | |
set isofile=/antergos.iso | |
search --no-floppy --file ${isofile} --set |
/** | |
* Solves the n-Queen puzzle in O(n!) | |
* Let p[r] be the column of the queen on the rth row (must be exactly 1 queen per row) | |
* There also must be exactly 1 queen per column and hence p must be a permuation of (0 until n) | |
* There must be n distinct (col + diag) and n distinct (col - diag) for each queen (else bishop attacks) | |
* @return returns a Iterator of solutions | |
* Each solution is an array p of length n such that p[i] is the column of the queen on the ith row | |
*/ | |
def nQueens(n: Int): Iterator[Seq[Int]] = | |
(0 until n) |
In a project I'm working on I ran into the requirement of having some sort of persistent FIFO buffer or pipe in Linux, i.e. something file-like that could accept writes from a process and persist it to disk until a second process reads (and acknowledges) it. The persistence should be both across process restarts as well as OS restarts.
AFAICT unfortunately in the Linux world such a primitive does not exist (named pipes/FIFOs do not persist