Multiple network bonds in Debian 9 Stretch

If you try to configure more than one network bond in Debian 9 Stretch you will get errors when trying to bring up the second bond – this is due to the fact that only one bond is configured by default. In order to support more than one bond you need to make the following change:

Edit /etc/modprobe.d/bonding.conf and add the following:

options bonding max_bonds=2

… set the number to number of bonds you require.

In reply to your unsolicited recruitment email

<redacted>,

I ignore because I get too many emails to reply to all of them and I don’t completely trust recruiters to honor my requests to be left alone.

In my experience recruiters are very rude:

  • They don’t take the time to look into my background.
  • They contact me regarding positions that are unrelated to my skill set.
  • They contact me via a private work email address. Seriously?
  • They call me out of the blue during business hours.
  • They push their own agenda and don’t listen to me.
  • They don’t seek to form a relationship, something which would obviously be mutually beneficial.
  • They solicit referrals, which is simply rude.
    • Why would I pursue a position that you “hand picked” for me when you will gladly take anyone else I can steer your way?
    • Why would I risk my reputation for a referral fee of an iPad or a few thousand dollars? You should know that the candidate you are targeting is in an income bracket that is not excited by such things.

I take my career very seriously, if I don’t get the impression that you do as well then I want nothing to do with you.

I don’t mean to criticize you personally <redacted>. I don’t know you, it’s not fair of me to assume that you are just like all the other recruiters I have encountered. I don’t know how to recruit, I don’t know what tactics work, but I do know what turns me off as a candidate. I am sharing my experiences with you because you seem to be looking for some insight into my actions. I hope that you find this helpful in some way.

Have a nice day,
Sam

CloudFront CORS with Custom Origin

Modern browsers respect Cross Origin Resource Sharing which means they won’t load web fonts (.woff, .ttf, etc.) from a CloudFront distribution.

If you are using a custom origin (AKA your website) for CloudFront you need to do the following:

1. Send the header Access-Control-Allow-Origin: * when serving up web fonts on your server.

Example for Apache (in .htaccess):

 # Set CORS headers so CloudFront will forward them
 <FilesMatch ".(eot|ttf|otf|woff|svg)">
 Header set Access-Control-Allow-Origin "*"
 </FilesMatch>

2. Edit your CloudFront distribution Behavior to Forward Headers and add Origin to the whitelist. I know this doesn’t make a ton of sense but that’s how AWS set it up (source).

 

 

3. Invalidate your cache from the AWS console or just wait until CloudFront refreshes its cache.

Use DateTime instead of Date for ActiveRecord ranges

I was working with a query that selected all “Orders” created this month, it looked like this:

 @today = Time.zone.now.to_date
 @start_date = @today.beginning_of_month
 @end_date = @today.end_of_month
 @orders = Order.where(created_at: @start_date..@end_date)

and the resulting SQL query looked like this:

 SELECT `orders`.* FROM `orders` WHERE (`orders`.`created_at` BETWEEN '2014-08-01' AND '2014-08-31')

…but since Rails automatically converts Date objects from localtime to UTC the dates in that query should have been offset by my timezone (in this case PDT -7 hours).

The fix was simple, use DateTime objects instead of Date objects and Rails automatically calculated the offset based on my Timezone (config.time_zone):

@today = Time.zone.now.to_datetime
 # ...

and the fixed query:

 SELECT `orders`.* FROM `orders` WHERE (`orders`.`created_at` BETWEEN '2014-08-01 07:00:00' AND '2014-09-01 06:59:59')

Debug logging chef in Vagrant

Recently I wanted to enable debug level logging of chef-solo runs in a vagrant box. As it turns out there are two ways to do this and both appear to be undocumented:

 Vagrant.configure("2") do |config|
    # ...
    config.vm.provision :chef_solo do |chef|
      chef.arguments = '-l debug'
      # ...
    end
 end
 Vagrant.configure("2") do |config|
    # ...
    config.vm.provision :chef_solo do |chef|
      chef.log_level = :debug
      # ...
    end
 end

Sources: http://stackoverflow.com/a/18778690https://coderwall.com/p/covmpg

First time soldering: Raspberry Pi LCD kit

Adafruit has a great LCD+Keypad kit for the Raspberry Pi with excellent assembly instructions and  a nice Python library. I just had to order one along with my first Raspberry Pi.


After it arrived I picked up a 25W Radioshack Pro-Line soldering iron, some 60/40 rosin-core solder and got to work. Luckily I had an old, dead iPod mini to tear apart and practice on. After soldering the first dozen points I felt like I was getting the hang of it. All-in-all I think it came out pretty well.

Where are all the good WordPress themes?

I just switched to the default WordPress theme Twenty Twelve because my old theme was dated and not mobile-friendly.

Why the default theme? 

Most free WordPress themes suck. They are displeasing to the eye, bloated, and just too “bloggy”. I want a modern, responsive, theme that complements my content. Why is the WordPress community still failing to grasp these concepts? (For the record, “premium” themes also fall short.)

I can’t wait for Ghost. Hopefully its community truly appreciates the concepts that make it a great blogging platform.