# 2018.12.08 Transition

let gray = amt => color(amt, amt, amt);

function setup() {
randomSeed(7);
createCanvas(600, 600);

for (let i = 0; i < 200; i++) {
x1 = randomGaussian(300, 120);
y1 = randomGaussian(300, 50);
y2 = randomGaussian(300, 50);
fill(gray(x1 / 600 * 255));
line(x1, y1, x1, y2);
ellipse(x1, y1, 20, 20);
ellipse(x1, y2, 20, 20);
}
}


(View full source at https://repl.it/@BrockWilcox/Transition)

# 2018.11.12 Destroy Things

I think it's important to learn through destruction. I like to proble the edges of things, and one of the best ways of knowing where IS the edge is to go over it. So ... let's go over the edge.

First we need a nice fresh ubuntu:

awwaiid@zokei:~$docker run -it ubuntu bash root@1cf14a7465fd:/#  Now, this isn't a completely isolated machine or anything, but it'll do. Keep in mind that this is running as root on your machine (if you're running a Linux host at least, this is probably safer on osx), so you should be a little afraid. Fear will keep you on your toes! Let's cause a little destruction! Make sure you are INSIDE of this new ubuntu container, and then: root@1cf14a7465fd:/# rm -rf /  They always joke that you shouldn't do that. Turns out our lovely ubuntu is trying to help us not hurt ourselves, so we have to pass a special flag: root@1cf14a7465fd:/# rm -rf --no-preserve-root /  WHOA! Whole lot of errors. Many of them are very good things about how you can't remove stuff in /sys/devices because of it being a read-only filesystem (remember that running as root bit?). And now the fun begins. root@1cf14a7465fd:/# ls bash: ls: command not found  Oh right. "ls" is a command that is an executable program that lives at /bin/ls. Correction: LIVED. But no longer. That's ok ... tab completion still works! root@1cf14a7465fd:/# cd <tab><tab> dev/ etc/ proc/ sys/ root@1cf14a7465fd:/# cd etc root@1cf14a7465fd:/etc#  Great! So we can git directory lists. Let's look at some files root@1cf14a7465fd:/# cat <tab><tab> hostname hosts resolv.conf root@1cf14a7465fd:/# cat resolv.conf bash: cat: command not found  Oh right. No "cat" command either. What commands DO we have? Well, we have any bash built-in. And we have bash as a programming language with loops and all that. Now we start to get fancy. root@1cf14a7465fd:/# while read p; do echo$p; done < /etc/hostname
1cf14a7465fd


Nice. We can now look at the contents of files. But if we are ever going to rebuild our system we'll also need to write files. Easy!

root@1cf14a7465fd:/etc# echo 'echo "hello!"' > hello.sh
root@1cf14a7465fd:/etc# . /etc/hello.sh
hello!


We cheated a bit with that "." to "source" the file. I'm not sure how to make it executable, since we no longer have chmod. Maybe we'll try that next time.

# 2018.07.29 Multiverse Timetravel Accounting

I've been doing a spot of accounting at work over the last few months. This is clearly a failure of delegation and management on my part, but it has led to at least one deep observation that I mightn't have had otherwise.

## Accountants are secretly time travelers.

Perhaps that is a slight exaggeration. They don't ACTUALLY travel through time. But if you hang out with them a bit and observe their twisted time and verb conjugation ... well it's obvious that they would be right at home hopping around a branching multiverse.

For example, there we were at the end of June. Topic at hand: things that are going to happen in May, from the perspective of late April. Casual conversations include things like "If we put the new rule into place in late June, then when May hits we'll have to go all the way back to February to get the correct outcome". Mind bending! Daily conversation, without anyone blinking an eye.

Alternate timelines are discussed quite a bit also. They aren't quite stated this way, but basically they go along thinking in terms of events from timeline A, and then decide "No! Wait! We aren't in timeline A, we are in timeline B!!!!" and maybe freak out a little about how they now have to rewrite history to match the current reality or perhaps adjust the perception of the current reality to match the new history. Some of it even appears to be experimental, running simulations on previous events to try to see how it changes the present (well ... and the future).

One thing I'm glad of is the ethical standards to which time travelers.... er... accountants adhere. There is an ongoing insistence that no matter what timeline they find themselves in, they should reconcile with the past and ever move to a more obvious and simple future. Try not to change the facts of the past, but if you do please keep some integrity in the universe so it can have some degree of cohesion in the present.

Anyway. Take my advice. If you go adventuring around in your time machine, bring an accountant to keep track of what is going on.

• Is Google Making Us Stupid?
• I have a big stack of books that I've made ... fairly little progress on
• Maybe the internet is eating my brain!
• So now I will post links and bullets
• Base-4 fractions in Telugu
• Interesting explanation of the traditional Telugu fraction numbering. Also draws comparison to the traditional English measures
• Git remote branches and Git's missing terminology
• Presents a better understanding of git remote branches, highlighting that to really comprehend what's going on you must acknowledge the implicit local branch that is your cache of the upstream (such as origin/master)
• I'm a little worried that I'm going to end up linking half of MJD's blog posts. Oh well, they are great. Example, /dev/null Follies has a hilarious nerdy punchline.

# 2018.02.05 OddMuse Wiki Dockerized

I Dockerized this website yesterday! I had already built a cpanfile that declares the Perl5 dependencies of OddMuse, which made it easy. I'm also going to run this with the data directory directly bind-mounted.

First the Dockerfile:

FROM perl:latest

# Set up the deploy user
ARG uid=1000
ARG gid=1000
RUN echo groupadd -g $gid deploy RUN groupadd -g$gid deploy
RUN useradd --create-home -u $uid -g$gid -ms /bin/bash deploy

WORKDIR /app

COPY cpanfile .
RUN cpanm -qn --installdeps .

USER deploy


The bit of fancyness here is the deploy user setup. Since I'm mounting the project directory for data files, I'd like new files and edits to be done by my normal user. On my cloud-server, this is uid 1000, which is easy to set as the default. On my laptop I run as user 1001, so the file is parameterized for this case. When I run locally, I have to build my docker image with docker build --build-arg uid=$(id -u) --build-arg gid=$(id -g). Not as much fun.

Otherwise, this starts with the Perl5 base image and installs the CPAN dependencies.

Next, the docker-compose.yml

version: '3'

services:

web:
build: .
command: starman --workers=10 --max-requests=1 --access-log starman-access.log --error-log starman-error.log oddmuse.psgi
volumes:
- ".:/app"
ports:
- "5000" # For running locally

nginx-ssl-proxy:
image: danieldent/nginx-ssl-proxy
restart: always
environment:
UPSTREAM: web:5000
SERVERNAME: thelackthereof.org
EXTRANAMES: www.thelackthereof.org
ports:
- "80:80"
- "443:443"
volumes:
- "/etc/letsencrypt"
depends_on:
- web


The first service runs Starman (this is similar to Unicorn for you Ruby folk). It mounts the project directory as /app, and runs oddmuse.psgi. We declare port 5000 anyway for local debugging -- we can then run only this service and it'll come up on a randomly assigned port that connects to port 5000. Other services on this network can connect to "web:5000" even without this declaration.

Which brings us to the second fancy bit. The danieldent/nginx-ssl-proxy image is a super cool image that gives an nginx proxy with automatic letsencrypt setup! You declare the domain name and the proxy destination (web:5000 is our Starman), and assuming that domain really is pointing here, it will work with letsencrypt to verify ownership and make certificates. The certs are stored in a docker-managed volume, and are periodically renewed. This takes less than a minute, so even if the volume gets accidentally deleted we can easily get a new cert.

Now running "docker-compose up -d" starts nginx and starman running in the background. All that remains is getting this running on boot. Since the startup command can be run over and over, worst case you can put it in a cronjob that runs frequently :)

Comments on TLT - 2018.02.05 - OddMuse Wiki Dockerized

### 1 Comment.

This is perfect timing for me !

I did something close with mine using apache a few months ago but I am not satisfied with it.
I run it onto my SAN Synology box.

See Oddmuse page for details on my recipe and see if we can make it better.

-- XavierMaillard 2018-05-10 07:57 UTC

More...

META INFORMATION: This is the technical blog and wiki of Brock Wilcox (awwaiid). Entries focus on my current projects, interests, and sometimes life events. If you'd like you can check out the list of All Entries or the RSS Feed. I also have a LiveJournal syndication feed for LJ friends.

2019-01-31

2018-12-20

2018-12-18

2018-12-13

2018-11-15

2018-07-02

2018-06-30

... more changes