Tuesday, 28 February 2017

Another shadertoy experiment.

Another shadertoy experiment.  There is a long and slightly boring story behind it, but I think I'll just show it to you. You can click in different places to change its settings.

Wednesday, 22 February 2017

wrong bash.exe when installing Windows Subsystem for Linux

If you're following the instructions at https://msdn.microsoft.com/en-au/commandline/wsl/install_guide to get Microsoft's Linux environment installed, but you also have a Ruby devkit on your path, the "Run bash" instruction doesn't work.  Because it runs the devkit bash instead of the WSL bash.

You want "Run c:\windows\system32\bash" instead.

Tuesday, 20 December 2016

TIL - harvesting energy by radiating heat into space

Today I learned:

I like that.

Monday, 15 August 2016

Shader: Pixel Dominance

Another shader toy:

So, I wondered what would happen if set up a shader where I flood filled pixels based on a function where every colour beats half of the colour space. I also introduce one new random pixel per frame. I quite like the intricate patterns that show up after a few minutes. Not what I would have expected. This is the function I used to decide which pixel won:

X and Y are R+G+B for the two pixels being compared.

Sunday, 17 July 2016

Embedding Shadertoy shaders in web pages

Did you know you can run custom GPU pixel shaders from javascript inside a web browser?  I am super delighted by that fact.

Shadertoy (https://www.shadertoy.com/) is basically Youtube for GLSL shaders.

You can embed a Shadertoy shader in a webpage using this little snippet:
<iframe src="https://www.shadertoy.com/embed/4td3Wn" style="height: 500px; width: 500px;"></iframe>

Just change "4td3Wn" in the snippet to the code for your shader.  The code is the bit after "/view/" in the URL of the shader you want. You'll also need to set your shader to "public" or "public + api".

Here's an example.  You can see the code at https://www.shadertoy.com/view/4td3Wn - but you might want to mute your speakers first.  I can't find a way to disable the sound on the video that the shader uses as a data source.  Also note that this shader in chrome doesn't work if you have two copies open (this embedded version and the shadertoy site, for example).

Saturday, 3 May 2014

Minecraft and turtles.

Today I learned you can buy(?) software that runs on virtual robots (called turtles ala Logo) that a Minecraft mod lets you craft.

I don't even need to look to know that someone is writing a version of Minecraft in Lua to run on a computer crafted in Minecraft.

The turtles can talk to each other, via an in game net or the real internet. I do so hope the singularity is triggered by a hivemind of virtual lumberjack robots.

Edit: Looks like 'premium' probably doesn't mean 'paid'. Unless they're doing the payment processing in Minecraft. I hope they are.

Wednesday, 12 February 2014

rails - `autodetect': Could not find a JavaScript runtime.

I was following this guide:

To get rails and heroku working.

But when I got to:

$ rails generate controller welcome

I got an error:

/home/tims/.rvm/gems/ruby-2.1.0/gems/execjs-2.0.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a
JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
from /home/tims/.rvm/gems/ruby-2.1.0/gems/execjs-2.0.2/lib/execjs.rb:5:in `'
from /home/tims/.rvm/gems/ruby-2.1.0/gems/execjs-2.0.2/lib/execjs.rb:4:in `'
from /home/tims/.rvm/gems/ruby-2.1.0/gems/uglifier-2.4.0/lib/uglifier.rb:3:in `require'
from /home/tims/.rvm/gems/ruby-2.1.0/gems/uglifier-2.4.0/lib/uglifier.rb:3:in `'
from /home/tims/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `require'
from /home/tims/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/tims/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `each'
from /home/tims/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `block in require'
from /home/tims/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `each'
from /home/tims/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `require'
from /home/tims/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler.rb:131:in `require'
from /home/tims/ruby/hsfeb/config/application.rb:7:in `'
from /home/tims/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:43:in `require'
from /home/tims/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:43:in `'
from bin/rails:4:in `require'
from bin/rails:4:in `

I fixed this by installing therubyracer gem:

gem install therubyracer

And then by uncommenting the therubyracer line in the project's Gemfile.

(Thanks to http://guides.rubyonrails.org/getting_started.html -
"Rails adds the therubyracer gem to Gemfile in a commented line for new apps and you can uncomment if you need it.")

Part 2

After starting the server and visiting / I got:

Started GET "/" for at 2014-02-12 23:50:54 +1000

PG::ConnectionBad (FATAL: Peer authentication failed for user "hsfeb"
activerecord (4.0.2) lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `initialize'
activerecord (4.0.2) lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `new'
activerecord (4.0.2) lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `connect'

This was easily fixed by following the instructions for setting up postgres, later in the document.

I'm added
ruby "2.1.0"
to my Gemfile instead of 2.0.0.