Skip to content

Instantly share code, notes, and snippets.

/*
* base64
* with no arguments read from stdin and write base64 encoded output to stdout
* with argument -d read base64 encoded input from stdin and write decoded output to stdout
* exit status 1 on any error
* ignores newlines in encoded input
* any illegal character in encoded input causes error
* no newlines in encoded output
* does not require padding (=) but if padding is present it must be correct
* after padding more encoded input may follow
@deepcube
deepcube / bsolve
Last active August 29, 2015 14:20
#!/usr/bin/env bash
# solve Rubik's cube using the Tperm blindfold method. input: http://tomas.rokicki.com/cubecontest/
# idea from Stefan Pochmann's second entry: http://tomas.rokicki.com/cubecontest/winners.html
n=0 tperm="R2 U' R2 D B2 L2 U L2 D' B2 U "
cube=("$@") solved=(UF UR UB UL DF DR DB DL FR FL BR BL UFR URB UBL ULF DRF DFL DLB DBR)
declare -A inverse=([\']=\ [2]=2 [\ ]=\') setups=(
[UF]="R2 U R2 " [UR]="" [UB]="R2 U' R2 " [UL]=""
[DF]="D' L2 " [DR]="D2 L2 " [DB]="D L2 " [DL]="L2 "
[FR]="U2 R U2 " [FL]="L' " [BR]="U2 R' U2 " [BL]="L "
[FU]="R F' L' R' " [RU]="" [BU]="R' B L R " [LU]="L F' D' F L2 "
#!/bin/sh
# https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour
# problem 5
# usage: ./p5_adding beg end goal
# e.g. : ./p5_adding 1 10 100
awk -v "beg=$1" -v "end=$2" -v "goal=$3" '
function f(cur, last, out, sum, op) {
if (cur > end) {
if (sum == goal)
printf("%s\n", out)
multi-pitch climbing transitions
general notes
-------------
always reply to commands
this let's the other climber know you heard him
e.g. climber calls "on belay" but belayer isn't ready yet, can't call "belay is on"
instead of waiting silently and climber calling out "on belay" again and again
say "thanks" as acknowledgment