This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <errno.h> | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/stat.h> | |
#include <unistd.h> | |
#define x(s,d,...)if(s){o=errno;fputs(*v,stderr);fprintf(stderr,": "__VA_ARGS__\ | |
);errno=o;perror(0);d;} | |
#define l while |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
typedef struct Node Node; | |
struct Node { | |
Node *next; /* next Node in the chain */ | |
Node *first; /* Node we started the chain on */ | |
int pos; /* position in chain */ | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <inttypes.h> | |
uintmax_t calls; | |
void print(int *chain, int len) | |
{ | |
for (int i = 0; i < len; i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Simulate add/remove events by writing directly | |
# into the uevent files. | |
if [ "$#" -ne 1 ] || [ "$1" != add ] && [ "$1" != remove ]; then | |
# warning: can't trust $0, better off just hard coding the name | |
# echo "usage: simevent add|remove" 1>&2 | |
printf "usage: %s add|remove\n" "${0##*/}" 1>&2 | |
exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <czmq.h> | |
#include <stdlib.h> | |
#include <zmq.h> | |
#include "zerr.h" | |
/* | |
* read message, switch first two frames (from and to), send it back out | |
* arg is the socket to which the message should be sent. For the front_end arg | |
* is back_end, and vice versa. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef ZERR_H | |
#define ZERR_H | |
#ifndef _GNU_SOURCE | |
#define _GNU_SOURCE // for program_invocation_name | |
#endif | |
#include <errno.h> | |
#include <stdio.h> | |
#include <stdlib.h> |
NewerOlder