An extremely simple CLI to POSIX stdlib realpath()
$ curl -O -L \
https://gist.githubusercontent.com/mckern/3349ed18e7ff7e18b96e5a06942fbe11/raw/d8a330fe0fb7b6ad56b867d8b91f2c954536ef41/realpath.c
ryan@bender fun-with-arrays.RHRjym $ bash reading-files-as-arrays.sh example-lines.txt | |
this is the first example's length: 46 | |
this is the first example's first item: | |
this | |
is | |
an | |
example | |
of | |
a | |
newline |
# frozen_string_literal: true | |
# Parse each line of key=value pairs into an array of separate key=value pairs. | |
# Some values will be in double quotes and contain white space, | |
# and some will not. All values with whitespace in them will be double quoted. | |
# No keys will be double quoted. | |
# annotated breakdown and explanation derived from | |
# https://stackoverflow.com/a/23613257, originally written by user | |
# https://stackoverflow.com/users/2195474/jbr in 2014 |
Hi Ryan, | |
We are excited to move you forward in the process! Please let us know if you have any questions. | |
<redacted>'s operations challenge is our primary means of understanding your troubleshooting and | |
programming abilities and the beginning of our understanding of the rest of your qualifications. | |
The challenge is divided into two parts. | |
For part one, we would like to assess your debugging and general Linux skills by asking you to install | |
the "apache2" package on a server that is misconfigured in many ways. It is your job to find, document, | |
and manually address these problems such that you are able to verify that the Apache web server is | |
accessible from the Internet. When you've verified the host is functional, please reply-all to this email |
An extremely simple CLI to POSIX stdlib realpath()
$ curl -O -L \
https://gist.githubusercontent.com/mckern/3349ed18e7ff7e18b96e5a06942fbe11/raw/d8a330fe0fb7b6ad56b867d8b91f2c954536ef41/realpath.c
A simple example:
ryan@C02X43Q9JG5K tmp.kU0KEN9U $ tree .
.
├── fakepaths
│ └── bin
│ └── shell.sh -> ../realpaths/bin/shell.sh
└── realpaths
├── bin
misfortune teller | |
short-stack developer | |
cargo cult leader | |
pastor of muppets | |
q.e.d. engineer | |
equine orthodontia | |
bovid depilatory | |
cultural insensitivity | |
rabbit hole excavator | |
omphaloskeptic |
#!/usr/bin/env bash | |
# Copyright 2017 Ryan McKern <ryan@orangefort.com> | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 |
" Vim color file | |
" Converted from Textmate theme Slush & Poppies using Coloration v0.2.5 (http://github.com/sickill/coloration) | |
set background=dark | |
highlight clear | |
if exists("syntax_on") | |
syntax reset | |
endif | |
let g:colors_name = "Slush & Poppies 256" | |
hi Cursor guifg=NONE guibg=#000000 ctermbg=0 gui=NONE | |
hi Visual guifg=NONE guibg=#b0b0ff ctermbg=147 gui=NONE |
#!/bin/bash | |
whitespace() { | |
local character="${1}" | |
local quantity="${2:-$LINES}" | |
for line in $(seq 1 ${quantity}); do | |
printf "%s\n" "${character}" | |
done | |
return $? |