Tweeting with Huginn and Twurl

After deploying Huginn I wanted to connect my Twitter accounts, so every blog post would be automatically tweeted.

The problem is, there seems to be an issue in the Twitter Service either in Huginn or at Twitter. which I’m sure someone is working on fixing it.

However, I was able to find a workaround by using Twurl, a curl-like application for interacting with the Twitter API.

You will need to do a couple of things.

  • Make sure you have a Twitter app API (click here for more info)
  • Make sure you have ENABLE_INSECURE_AGENTS set to true in Huginn’s .env
  • Install twurl. It was not available as a FreeBSD package, I installed it using RubyGems: gem install twurl

Next, you need to authorize your app (commands from Twurl’s with the same Unix user that’s running Huginn;

twurl authorize --consumer-key key       \
                --consumer-secret secret

And now we need to set up a new Shell Command Agent.

Now, I had to spend a lot of time to make it work, the command-line options are very… sensitive.

This is what I ended up with;

  "path": "/",
  "command": [
    "Content-type: application/json",
    "{\"text\": \"{{title}} | {{url}}\\n{{content | strip_html | replace: '\\n', ' ' | truncate: 128}}\"}",
  "unbundle": "true",
  "suppress_on_failure": false,
  "suppress_on_empty_output": "false",
  "expected_update_period_in_days": 15

Let’s go one by one.

The path does not matter, as we’re not interacting with files.

I am running FreeBSD so my twurl command path would be /usr/local/bin/twurl. You may run which twurl to find yours.

The /2/tweets is the resource we’re sending a request to, -A is for headers, and -d specifies the data of the body (hence, implies it’s a POST method).

My sources are RSS feeds, so I’m using things like {{title}} and {{url}}, you can do whatever you want. Since I’m inserting a JSON in the JSON, I had to use \\n so it converts to \n in the command. Be careful about that.

In the end, -t will “trace” the command, so we can see (if needed) the POST request as well as the result.

The unbundle parameter tells Huginn to not use the Ruby Gems that are in Huginn, instead, the command is run in a clean environment, outside of Huginn’s bundler context.

I left everything else as is.

Now, you can tweet from Huginn.

NOTE: You can use the -u flag with twurl to specify which account to use, refer to Changing your default profile for more info about that.

And now, all works fine.

That’s all folks…

Citing Saturday: John le Carré

If you haven’t watched it, I totally recommend you check out The Night Manager, either the novel or the TV series.

As I said before, I’ll be doing Citing Saturday, which I’m doing on Sunday, but technically Monday, because I messed up my sleeping schedule.

And here’s a quote:

Promise to build a chap a house, he won’t believe you. Threaten to burn his place down, he’ll do what you tell him. Fact of life.

– John le Carré, The Night Manager

That’s all folks.

Huginn on FreeBSD

Huginn is probably the best automation software that I’ve ever seen. It’s not only easy to use, but also easy to deploy and easy to extend. Unfortunately there’s no FreeBSD port for it, but looks like it’s something wanted by the community, at least according to WantedPorts.

I realized that I have at least 5 accounts on IFTTT, which is also an amazing automation service. However, 3/5 of these accounts were not “my own”. It belonged to our communities. You know, Meetups in Armenia and news listing websites similar to So if I get hit by a bus, it will be very hard for our community to operate these accounts, that’s why I wanted to deploy Huginn.

Like a sane person, I deploy in FreeBSD Jails (I recommend you do too!). Which meant there’s no official (or maybe even unofficial?) docs on how to deploy Huginn on FreeBSD.

It’s written in Ruby, which means it should work and should be very easy to ports. I’ll go over the deployment needs without the actual deployment, setup of Jails, or anything similar. Let’s go!

First thing first, you need Ruby thingies:

  • ruby
  • rubygem-bundler
  • rubygem-mimemagic
  • rubygem-rake
  • rubygem-mysql2

Here’s the full command for copy/paster:

pkg instal ruby rubygem-bundler rubygem-mimemagic rubygem-rake rubygem-mysql2

Next, you’ll need gmake for makefiles and node for assets:

pkg install gmake node

This should be enough. I’m also going to install git-tiny so I can follow their updates with ease.

pkg install git-tiny

Okay, let’s make a separate user for Huginn.

pw user add huginn -s /bin/tcsh -m -d /usr/local/huginn

Let’s switch our user

su - huginn

Okay, now I’m going to clone the repo 🙂

git clone --depth=1

At this point you can go do and configure your database.

You should also do cp .env.example .env and configure the environment, make sure to set RAILS_ENV=production

Next, as root, you should execute the following

cd /usr/local/huginn/huginn/ && bundle install

You might get an error saying

In Gemfile:
  mini_racer was resolved to 0.2.9, which depends on

Don’t panic! That’s fine, unfortunately it’s trying to compile libv8 using Gems. Even if we installed the patched version of v8 using pkg, it still doesn’t work. I’ll try to workaround that later.
I an ideal world, all of these Ruby Gems should be ported to FreeBSD, I’m not sure which are ported, so I’ll just be using the bundle command to install them. And that’s why we use Jails 🙂

Anyways, the dependency Gem is mini_racer, comment its line in Gemfile

#gem 'mini_racer', '~> 0.2.4'      # JavaScriptAgent

Now let’s run Bundle again

cd /usr/local/huginn/huginn/ && bundle install

Okay! everything is good!

Let’s also build the assets, this one should be run as the user huginn

bundle exec rake assets:precompile RAILS_ENV=production

NOTE: If you get the following error ExecJS::RuntimeError: /lib/ version OPENSSL_1_1_1e required by /usr/local/bin/node not found then you need to upgrade your FreeBSD version to the latest patch!

Aaand that’s it, everything is ready.

For the rest of the deployment process, such as the database, nginx, etc., please refer to

Currently, I’m running Huginn in a tmux session running bundle exec foreman start, but in the future, I’ll write an rc.d script and share it with you, too.

That’s all folks.

Fortune in Times of Need

I was setting up Huginn on FreeBSD, I needed to do some manual testings of commands before I automate them, one of them was using twurl to Tweet. When I was trying to tweet in Armenian, the terminal prompt was giving me a bell. I realized that I needed to change the locale.

When I opened another shell to change the locale, FreeBSD’s fortune printed the following:

In order to support national characters for European languages in tools like
less without creating other nationalisation aspects, set the environment
variable LC_ALL to 'en_US.UTF-8'.

Ah, thank you!

By the way, if you ever saw a fortune that you liked and you needed it later, but didn’t remember the details, you can do fortune -m pattern freebsd-tips, here’s an example:

% fortune -m USB freebsd-tips
%% (freebsd-tips)
If you need to create a FAT32 formatted USB thumb drive, find out its devicename
running dmesg(8) after inserting it. Then create an MBR schema, a single slice and
format it:

# gpart create -s MBR ${devicename}
# gpart add -t fat32 ${devicename}
# newfs_msdos -F 32 -L thumbdrive ${devicename}s1

                -- Lars Engels <>


Music Monday: gorgeouz beats

I saw the silly milestone of Rubenerd regarding 8,000 blog posts and the feedback about it, which got me thinking: even if I don’t blog what’s on my mind due to lack of time and skills, I can, still, blog about some things that I like. Following the concept of Music Monday, I’ll be also doing Citing Saturday, where I cite whatever I find interesting, that being technical, political or otherwise.

So two posts a week (at minimum) that’s 2×52 = 104 posts in a year.

Am I trying to reach a number? No. I’m just trying to build a framework where I can be more… consistent.

So, Monday it is, I’d like to present an artist that I found about late last year, and I’ve been buying his work from iTunes Store since then, please welcome, gorgeouz beats, a musical experimental laboratory.

Here are my favorites:

ZFS compression is so good that it cost me 2 hours

So we have this build machine (build0) where we build FreeBSD in Jails and then we mount the src and obj dirs via NFS or we sync them using rsync to destinations so we can run make installworld on not-so-powerful servers.

Couple of days ago we had a network issue at the data center, the switches crashed and we had to reboot them. Turns out I was running rsync on one of our servers, so I decided to make sure that the files were copied.

Like a lazy sysadmin, I run the following commands on both the build0 server, as well as the remote host.

root@build0:~ # du -h -d 0 /usr/local/jails/f130/usr/obj/
 13G    /usr/local/jails/f130/usr/obj/

root@illuriasecurity:~ # du -h -d 0 /usr/obj/
5.5G    /usr/obj/

Hmm, maybe files were not copied properly? So I remove the obj dir and I rsync again.

Looks like the size is 5.5G AGAIN!

So I do a little bit of piping!

root@build0:/usr/local/jails/f130/usr/obj # find . | sort > /tmp/obj_build0.txt

root@illuriasecurity:/usr/obj # find . | sort > /tmp/obj.txt

zvartnots:~ $ scp illuria:/tmp/obj.txt  /tmp/
zvartnots:~ $ scp build0:/tmp/obj_build0.txt /tmp/

zvartnots:~ $ diff /tmp/obj.txt /tmp/obj_build0.txt

Um, no difference?

Looks like the size reported by du was… confusing?

Okay, let’s check the manual of du(1):

     -A		Display the apparent size instead of the disk usage.  This	can be
     		helpful when operating on compressed volumes or sparse files.

Oops, looks like ZFS compression is enabled on my machine…

Let’s try this again!

root@build0:~ # du -h -d 0 -A /usr/local/jails/f130/usr/obj/
 12G    /usr/local/jails/f130/usr/obj/

root@illuriasecurity:~ # du -h -d 0 -A /usr/obj/
 12G    /usr/obj/

Ok! This makes more sense 🙂

Let’s also check with ZFS.

root@illuriasecurity:~ # zfs get compression zroot/usr
zroot/usr  compression  lz4       inherited from zroot

I wonder what’s the build0 server is doing?

root@build0:~ # zfs get compression zroot/usr
cannot open 'zroot/usr': dataset does not exist

Hn o.O ? Oh yeah, I wonder.

root@build0:~ # mount | grep ' / '
/dev/ufs/rootfs on / (ufs, local, journaled soft-updates)

Okay, this makes much more sense now 🙂

That’s all folks!

Techlife Crisis

This is another migration story, like the one that I wrote back in 2020. Unlike the other story, the motivation of this migration is totally different. It’s emotional instead of technical.

Last year a friend of mine got a new job that I referred her to. She passed the interviews and I helped her to get on-boarded as the employer was a friend of mine and I was pretty familiar with their product. The job was remote and she didn’t have a good laptop. Since I have many laptops I ended up giving her my ThinkPad T480s where she ran Ubuntu. As you can tell the employer was a VERY close friend of mine 🙂

All of this meant that I moved back to my MacBook Pro running macOS. I used to like macOS, for me it was always a rock-solid UNIX system with a proper graphical interface.

Unfortunatly these years the UNIX part is not solid anymore and the graphical interface is more iOS-y eye candy than a proper desktop interface.

But I was okay with that, since I spent most of my time in a terminal running vim, ssh, etc. I’d run typical work apps like with GPGSuite and a Slack browser client.

But then something snapped in me. I think it was after the car accident. I spent two weeks at home, not able to work. So I started coding on my open-source projects again, doing some patches in FreeBSD, improving code on software that I like and so on.

I realized that I’ve been an Open Source advocate for years, and yet I was in the Apple ecosystem. Not that I don’t like the Apple ecosystem, don’t get me wrong, but as someone who’s been telling the government to use open source, helping them migrate, giving lectures to students about the open source movement and its history, I felt… bad.

I had this MacBook Pro laptop and this iPhone that both control me more than I can control it.

I contacted my friend again, asking if we can swap the laptops and she told me yes. She actually ended up working at our company and now she has a fancy new MacBook Pro while I came back to my lovely ThinkPad T480s running FreeBSD like I wanted in the first place.

As I mentioned, this time it hit me hard, so I decided to escape non-OSS things completely and now I’m running a Pixel 2 with Lineage OS.

There’s a whole story on how I got that Pixel 2 at this day and age and that story is coming soon. And the funniest thing is, as soon as I completed my transaction/migration to Open Source, I got the news that Apple Pay will finally work in Armenia.

Open Source changed my life when I was a kid in Syria, I learned more about computers because of Open Source and while I got distracted with the cute and nice macOS for a while, it’s time to come back home.

Here’s a screenshot

That’s all folks!

Wrong Indicators

Bryan Cantrill has this amazing talk about debugging where he tells the story of Three Mile Island.

After watching that talk all I thought was “well, let’s hope this doesn’t happen in my life”, and by “my life”, I meant my personal or work server, not my AFK life!

55 days ago my girlfriend and I moved to a new apartment downtown the capital. I like everything about this house, specially that many things are electric, including the stove.

Like a sane person, when I see a stove with multiple levels (1, 2, 3) I assume that the lowest number is the lowest and highest number is the highest.

Now you’d think and say “Antranig, didn’t you notice that your cooking was talking 2 hours, so there must be something wrong?”

Oh no, my friend, very much no. As you can see we have two stove tops, a small one and a big one. Now, the small one is working very fine. At the highest level it heats more than at lowest level.

But the big one, the big stove top, not so much.

We thought that there’s a problem with that top and used it only during slow emergencies.

One day I come home from work and Lilith is laughing. I asked “what happened?” and she replied “you’re not gonna believe this!”

Well she was right, it’s been couple of days now and I still can’t believe this. I mean if both of the stove tops were in reverse order, I would understand that someone was very Unix-y and they wanted to design it similar to nice.

But when each of those knobs are the exact opposite of each other, it makes you think, “why me?”

Why me indeed.

That’s all folks!

2021 Retrospective

Lately Rubenerd blogged about Reading people’s blog archives and I remembered that I used to do that when I had nothing better to do. One of my favorites was Norayr’s yearly retrospective. Let’s try doing the same here.

I’m happy that I’m not doing this last year, as 2020 was the year of pain, loss and war.

2021, on the other hand, was the year of happiness, gain and love.

Let’s start 🙂

Personal life

  • I finally had a proper vacation
  • I moved with my girlfriend, Coffee, to a new apartment!
    • It has an amazing view of our lovely city, Yerevan 🙂
  • Had a car accident around October
    • No major incident, fully recovered
  • My ideological crisis made me rethink my technological choices


  • I moved to open-source Android, LineageOS, running on my Google Pixel 2 phone.
    • You’d think that now I’ve completely ditched Apple, but that’s not true.
    • A friend of mine needed a laptop, so I moved back to my MacBook Pro and gave her my ThinkPad T480s
  • I learned JavaScript and started writing VueJS at work
  • Wrote a new FreeBSD Jail orchestration software named Jailer. I planned on open-sourcing it in the Summer, but with the lack of hands I hope it will be released Spring of 2022
    • I moved all my servers to Jailer
  • I ditched music streaming services and I’m more than happy with this choice
  • I moved all my networks to WireGuard and I’m happy with that choice too!


  • I wrote 65 entries, which makes me sad. I hope I will blog a lot more in 2022
    • I wrote a blog post about blogging regularly where I mentioned Jamie Zawinski. Then I emailed that blog post to him. When I was drunk. I also mentioned that I was drunk. Good thing he replied 🙂
  • 3 of my entries were posted on the orange site with many people commenting about them
  • I added a comment section to my website using isso
  • Reading more about blogging led me to learn about Dave Winer
    • Which led me to learn about OPML and oldSchoolBlog, which I still don’t know how to use or even if I should
  • I redid the theme of my website based on Archie theme which was written by Athul
  • I automated my writing process using Shell Scripts


  • I organized the first Systems We Love — Armenia meetup
    • The plan was to make it a monthly thing, but life happened
  • For years I dreamed about an Armenian Open-Source Ecosystem, as of 2021 we have
  • We went to the city of Stepanavan and organized a GradaranCamp (LibraryCamp) at the Stepanavan public library. Unlike me, my friends continue organizing it
  • I started using Twitter Spaces which led me to talk with my idols, including Bryan Cantrill. His talks have shaped my methodology and ideology for years. I don’t have the word to describe how happy I am about this. I kinda still don’t believe it 🙂


  • I have given 8 talks this years, including and not limited to
    • Portland Linux/Unix Group Online Meeting: 360Cloud based on FreeBSD
    • BarCamp 2021: FreeBSD Cloud
    • BarCamp 2021: Open-Source ecosystems and Armenian tech communities
    • BarCamp 2021: Information Security Panel
    • PYerevan #15 Meetup: Tracing Production
    • ArmSec 2021: Tracing hackers for fun and profit
    • ArmSec 2021: DNSSEC in Armenia


I hope 2022 brings the best to all of us.

That’s all folks