Connecting to a BEAM node via Elixir script

Start a distributed node with a name and cookie:

$ iex --name server@127.0.0.1 --cookie secret-cookie -S mix phx.server

Create a script:

# add.exs
script_node = :"script@127.0.0.1"
remote_node = :"server@127.0.0.1"
cookie = :"secret-cookie"

{:ok, _pid} = Node.start(script_node)
true = Node.set_cookie(remote_node, cookie)
:pong = Node.ping(remote_node)
true = Node.connect(remote_node)

:rpc.call(remote_node, Enum, :sum, [[1, 2, 3]])
|> inspect()
|> IO.puts()

Run the script:

$ elixir add.exs
6

Read the rest of this entry

I made an entry for Ludum Dare 28

So, I created a game for Ludum Dare 28. If you're not familiar with Ludum Dare, you can see their About page for a description.

It's basically a solo, from scratch, game development event over the course of a weekend (48 hours) with a theme. People are welcome to use any open source frameworks or tools (such as Unity 3D, GameMaker: Studio, LÖVE, etc) for creating their game.

I've been contemplating trying it out to see if I could make a game in 48 hours. Well...this past weekend was the first one I've had free since I started paying attention to this competition.

I didn't really prepare to create a game at all...but rather did it on a spur of the moment decision. I figured, what better time to try to create a game for Ludum Dare than now? After all, actions speak louder than words.

Here is my very first Ludum Dare 28 entry: Existence

It can be played at: https://pyjamacoder.com/ld28/

And the source code can be retrieved from github: https://github.com/donaldducky/ld28-existence

Here's what it looks like:

Dog surrounded by skeletons

Read the rest of this entry

Getting Fuzzy with CtrlP and Vim

Ever since I started using Vim, I've been looking for ways to improve my workflow. It wasn't until recently that I've felt my use of it had stagnated. I knew there were better ways in doing a lot of things but I never took the time to look into it.

I write text in a variety of languages such as: Javascript, PHP, Bash, CSS, Markdown and sometimes even Ruby. The one thing they all have in common? Vim. Improving how I use Vim will help me edit files more efficiently regardless of the language.

After creating related.vim and writing my previous post, I realized that I didn't know too much about some of the plugins I used. I knew that they were powerful but I had yet to take advantage of that power.

One of the plugins I mentioned was: CtrlP

I was having issues using it because the project I was working in had 15,000+ files but I found a way around it.

Read the rest of this entry

April 25, 2013 Vim

©2018 Donald Chea, Pyjama Coder