Suranyami

Polyglot developer, geometric tessellation fan, ambient DJ. Edit profile

Countries

Language

(ni) ほん (hon)(go) Japanese (language)


えい (ei)(go) English (language)

Nationality

(ni) ほん (hon) じん ( jin) Japanese (person)
えい (ei)(go)
English (language)

Nationality

(ni) ほん (hon) じん ( jin)
Japanese (person)

Discuss...

I had a bit of a mystery that was bugging me for ages. After enabling automatic formatting for Elixir files in VSCode, I was getting ugly highlighting that looked like this:

Ugly highlighting

It turns out this is a feature of the RainbowIndents extension to show you where you have inconsistent indenting (e.g. 3 spaces, when everything else is 2).

The problem with this is mix format has unchangeable opinions about indenting, such as in a with statement, where it cares more about alignment than even/odd indent boundaries.

The fix is to exclude indentation errors for Elixir. In your settings.json add this:

This was the fix.

With that in place, we now get plain ol' rainbow indenting:

Fixed!

Discuss...

This first appeared in a forum post on community.fly.io

I've updated it a bit with some clarifications and a fix for a version-clash issue I had.

Setup the project

$ mix phx.new hello  --umbrella --no-ecto --install
$ cd hello_umbrella

Enable server in config/runtime.exs:

config :hello_web, HelloWeb.Endpoint, server: true

Add elixir_buildpack.config with the preferred Erlang and Elixir versions:

$ cat <<EOF>./elixir_buildpack.config
elixir_version=1.14
erlang_version=24.3
EOF

I had problems with too-specific versions in the above, so just use major versions, e.g. elixir_version=1.14 versus elixir_version=1.14.3-otp-24

Deploy the assets from within the web app directory:

$ cd apps/hello_web
$ MIX_ENV=prod mix assets.deploy
$ cd ../../

Setup the Fly stuff

$ fly launch

Answer “no” to deploy request and leave fly launch, then set up the secret:

$ export SECRET_KEY_BASE=$(mix phx.gen.secret)
$ fly secrets set SECRET_KEY_BASE=$SECRET_KEY_BASE

Deploy:

$ fly deploy

Enjoy your app!

$ fly open

and the umbrella application is finally happily up and running!

Summary

Besides the steps above, here are the summary of the current differences in how Fly handles deployment between plain and umbrella.

to deploy an Umbrella via Fly:

  • you have to explicitly set server: true in config/runtime.exs
  • you have to add the required elixir_buildpack.config file to the project
  • you have to build the application assets
  • you have to set the SECRET_KEY_BASE executing fly secrets after fly launch and before fly deploy (you can’t just export it to an environment variable)
  • the Fly builder will not generate a Docker file as is the case with plain apps (but if you supply one, the builder will use it)

Discuss...

Install iperf

on MacOS:

brew install iperf

on Linux:

sudo apt install iperf -y

Start iperf on the server:

iperf -s

This waits for incoming connections from clients. Designate another machine as a client and run this command, substituting the IP address of your server machine for the sample one here:

iperf -c 192.168.1.2

Results

Setup was:

LAN config

Results were:

> iperf -c 192.168.1.238
------------------------------------------------------------
Client connecting to 192.168.1.238, TCP port 5001
TCP window size:  128 KByte (default)
------------------------------------------------------------
[  1] local 192.168.1.91 port 58359 connected with 192.168.1.238 port 5001 (icwnd/mss/irtt=11/1448/12000)
[ ID] Interval       Transfer     Bandwidth
[  1] 0.00-10.28 sec  63.9 MBytes  52.1 Mbits/sec

Discuss...

When setting up profiles for AWS locally, start with your own credentials as default, then add profile entries for the different environments. e.g.

# ~/.aws/config

[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

[profile staging]
role_arn = arn:aws:iam::0987654321:role/staging
source_profile = default
region = ap-southeast-2
output = json

[profile prod]
role_arn = arn:aws:iam::5678901234:role/prod
source_profile = default
region = ap-southeast-2
output = json

Discuss...

Well, of course Snoop Dogg has a cookbook with an introduction by Martha Stewart, and yes, I did buy it, thanks for asking.

Quick review: this cookbook is ideally something you give to a stoner teen that’s about to move out of home for the first time. The recipes are super-basic, with some nice twists, but require no complicated ingredients and the processes will not stretch anyone’s brain.

The layout and text are a lot of good, clean fun and nothing is taken too seriously. From that point of view, he’s done a great job at making cooking for yourself more accessible.

I’d keep this to give to my daughter when/if she moves out, but she’s already awesome at making schnitzel, bake cakes and muffins, etc. and she’s only 12, so I think she’ll be fine by the time she’s in her late teens…

Discuss...

date "+%Y-%m-%d"

Mucked around trying to get this right before realising I'd left out the + symbol in the format string. Derp.

Discuss...

Since I've been playing around with using Obsidian to organise myself, I tried out some of the MathJax support. These are some examples I've tinkered with.

MathJax

Quick guide

Examples

An example of inline MathJax $\alpha, \beta, …, \omega$

$$\begin{matrix} 1 & x & x^2 \ 1 & y & y^2 \ 1 & z & z^2 \ \end{matrix}$$

$$ \begin{vmatrix} a & b \ c & d \ \end{vmatrix}=ad-bc $$

$$ \sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6} $$

$$ 10^{10} $$

$$ {x^y}^z $$

$$ x^{y^z} $$

$$ x_i^2 $$

$$ x_{i^2} $$

$$ \Biggl(\biggl(\Bigl(\bigl((x)\bigr)\Bigr)\biggr)\Biggr) $$

$$ \left(\frac{\sqrt x}{y^3}\right) $$

$$ \frac ab $$

$$ \frac{a+1}{b+1} $$

$$ x \approx y $$

$$ \sqrt[3]{4} $$

$$ \infty $$

$$ \aleph_0 $$

$$ \nabla $$

$$ \partial $$

$$ \Im $$

$$ \Re $$

Discuss...

The new improved Ozzie term for “Abbreviation” shall henceforth be known as a “brev”.

As in:

“I brevved it” “it's a brev” “I'm brevving it”

Let's make it happen, people!

Our reputation as the dimunitive-superpower of the world is at stake.

October 18th, 2015 8:54pm

Discuss...

August 22 2012, 9:57 PM

Quite a few people have been asking me where “suranyami” comes from lately, which caused me to remember that I hadn’t transferred over the Suranyami Bullet story when I moved over to Posterous.

So here it is. This was a 2-part dream with a sequel that occurred over New Year’s Eve / Day and then 6 months later. I wrote it all down as soon as I woke up, because it was unusually vivid.

Suranyami Bullet

19981231

Suranyami Bullet

The war between Iraq and the USA had reached a point of extreme ridiculousness and was now taking criticism from all of the Islamic states, and many other nations also. Hundreds of cruise missiles were poised, and then fired from US carriers. Suddenly, one by one, they all disappeared. There was an ominous and eerie silence which was followed by a brief public broadcast from an obscure, fundamentalist (yet, pacifist) Islamic sect. They said that the time had come for the use of the Suranyami Bullet, a sacred object that they had been secrretly guarding for over 10,000 years. This was why all the missiles had failed. They said that when the Suranyami Bullet was fired it could shoot every individual human on the Earth straight through their heart, and that this was no idle threat.

At the very same time, I got an urgent email from an old friend, Julie Chan, asking me if I was available to work immediately on the most significant nanotech project ever devised: “the Suranyami Bullet”. I said “yes”. When I got there (in the Middle East) I found the most amazing laboratory… sophisticated beyond your wildest dreams. It had been built in one day by the simple insertion of a small metal key into a slot in this small bronzey-coloured bullet with little red spheres studded around one end of its casing. The ensuing nanotech lab was a “setup station” for the full release of its capabilities. Yesterday’s missile deactivation had been almost a trivial exercise once it had been activated. Now came the fascinating task of working out what it could really do, how it did it, and why had it been held in safe keeping for thousands of years by a group of devout Muslim priests.

Here were programmers, mathematicians, philosophers, physicists, chemsists etc… all coming to grips with this tiny device that was more powerful than anything else in the universe so far.

My initial doodlings at disassebling its products started with requesting a pencil to be produced and then using the equipment available to analyse it. The pencil had the unusual property that if you twisted it, it grew and shrank in girth and pencil-stroke darkness. I ran a scan for any structurse that had a structural similarity to a computer language statement such as:

ON EVENT(type) DO
  Statement
END

…etcetera and soon discovered many, many types of these structures, mostly idle, scattered throughout the entire makeup of the pencil. There seemed to be a pretty predictable one-to-one correspondence between the machine-micro-circuits and typical computer instructions, so I modified a cross-compiled hack of Fractal Painter and soon had a pencil that had the full functionality of Painter… touch this for this brush, press the ? and out unfolded an interactive instruction page, bend here to activate the image hose, etc… geeks emailed copies of the compilation code to each other with much delight.

19990101 Part 2

It turned out that the knowledge of when to activate the Suranyami Bullet had been passed down as an oral tradition from teacher to student for as long as anyone could speak. The time to activate it would come as a definite feeling by those who were physically near it. This was one of the major “tricks” that it was apparently capable of… that it had some form of psychic influence, but was obviously based on sound scientific principles.

Good progress had been made towards understanding it and how to take it to the next level. Upon activating Level 2, the thing burst up, down, in and out all at once, simultaneously consuming and producing at a massive rate.

Analysis had shown that, what looked like a large section of the bullet that was dedicated to “construction plans”, was in fact nothing but a big decompression algorithm. The data that it was decompressing turned out to be only 1 bit in length. It was anticipated that the output of the compression was a set of instructions, the size of which was in the googleplex range (10^(10^100)).^^

Somehow, the compression algorithm was always uniquely design to decode the same number, but using different techniques and pseudo-random number seeds would come up with wildly varying output. In fact, it was theorised that if we could understand the algorithm that designed the compression algorithm each time, we could compress any amount of data into 1 bit.

The bullet was now expanding at an enormous rate, consuming the ground, trees, buildings, etc… and looking like a cross between video static, pin-cushioned inflatable leather, nuclear powerplant plumbing, circuitry, organic mould and you-name-it. It inflated around and through everything, and by-and-large, pushed people harmlessly away from it.

In what seemed irrelevant (at first), I was asked to attend a funeral or my Uncle Jimmy by my Sister, Mum and Nana. They were very upset and worried about the strange, evangelical, bargain-basement, charismatic church sect that Auntie Babs had proposed for the funeral. They wanted me to go and talk some sense into her, so, could I sit in with Babs at the dress rehearsal for the funeral, which required a male for half of the burial ceremony.

The funerals this church did were a bit like the Reverend Moon mass marriage ceremonies, where stadiums were filled with lots of couples. I joined Babs and sat on the sideways-backwards seats that were used. We were in a huge L-shaped church hall with hundreds of others that were also burying people.

We had to put hand puppets on at various times, while we were rocking back and forth and cutting up bits of salami and saying the Eulogies in high-pitched, sing-song, cartoon voices. All the seats were alternating pink and white chequers and they rocked back and forth like fake stage-waves. Ultimately, it all got more and more surreal, to the point where I thought that I must be hallucinating, but it turned out that it was actually part of the bullet’s influence.

It had been gradually assimilating and rearranging everyone’s personalities and consciousness in to itself and this was a combination of some moral lessons that it wanted to teach, and the fact that it fully hadn’t grasped the subtleties of our lives and communication styles yet. The transition had seemed to happen quite smoothly at first, since it had a significant knowledge of how our bodies processed sensory data, and it was a fairly simple matter for it to release nano-bots into our lungs and the bloodstream that would then travel to the various parts of the body and start feeding false information into synapses.

A group of others and myself soon found ourselves suspended in a spherical field surrounded by the bullet’s machinations as far as the eye could see, which must have been millions of miles—there was no horizon. It had already become so big, it told us, that communications between parts of itself was suffering week-long lag times just to send messages, so it had developed time-space folding techniques to hyperspace signals and structures throughout itself. The devices to do this looked like identical mirror-inverted CDs without holes in the middle… a bit like the stepping disks in Ringworld. One side of each disk was a field that caused a time-space discontinuity whereby you could put your arm through one disk and it would start protruding out of the other disk, no matter how far apart they were.

We were being accelerated to the speed of light, now, whereby henceforth we would be increasing our mass and energy towards infinity, reducing the rate of time passing to zero, and becoming identical to light. As time stopped, we became immortal and at one with God: the Suranyami Bullet.

A new God-King-Emperor! Hurrah!

19990610

Crest of the Yami-God-King-Emperor of Suran

Peter Pegg, the intrepid “Dr Livingstone” explorer with the pith hat, hurriedly ushered me away saying “David, we simply must be involved in this… it is a once-in-a-lifetime opportunity”. We were in the kingdom of Suran, where the Suranyami Bullet had come from. The current God-King-Emperor had just died… his status was similar to the Zion/Ethiopian Harley Selassi/Markus Garvey “incarnation of god that walks upon the earth”. Peter had done extensive and very respectful research into the ritual of choosing the next “Suranyami” and he had, in fact, been asked by the Suranese Royal Family to assist in their holiest of rituals… the passing down from father to son of the holy godhead.

The sacred tree room which had grown from Moses’ burning bush grown over thousands of years and turned inside out: it had one secret branch that grew from the outside through the trunk, inside the special room-cavity-altar exposing the holy knot, then continued back out through the trunk to the outside world again.

It was considered auspicious that there were two total foreigners there (surprisingly!) because there had never been anyone from the outside world in the Kingdom of Suran… the coincidence was not taken as mere chance.

The three of us (the son, Peter and myself) entered the tree-room and Peter was asked to use the cylindrical saw to cut out the middle heart of the knot. When this happened, the new godhead flowed out of the tree in a sacred fire that would settle down (usually) on the head of the King’s son… but to everyone’s shock, it settled on mine. I wore the holy flame which engulfed my mind and skull.

There was nothing else to do but walk proudly out onto the branch-walkway and claim myself as the new God-King-Emperor of Suran.

Soon, we were whisked off in a convoy of pink cadillacs with 50s housewives wearing John Galleano-esque lemon-yellow, pistachio-green and pretty-pink shirts and flowing skirts, accessorised with long gloves. The celebrity cavalcade wandered along winding coastal roads to the theme of “A Summer Place” with all the ladies waving their hands like the Queen does, holding their parasols, and rejoicing “Oh, hooray! We have a new God-King!”

September 9th, 2013 3:00pm

Discuss...

Enter your email to subscribe to updates.