Code without abbrivations

My son is learning his computer language and yesterday he asked me what do the method Intn(n Int) – I can’t answer.

Here are some very popular examples

  • dev > development
  • prod > production
  • ctx, ctx > context vs
  • obj > object

We are still in the dark ages of the computer programming. The evidence is that huge companies afford to give examples in their documentation with hackish examples.

Hackish AWS example

Running chef test-kitchen with newer vagrant

If you get

This means that the virtual machine needs a shorter name for the VM.

Bonus tip:

If you get

Then remove all gems and reinstall chefdk.

Export database tables, fields comments as markup with Ruby on Rails

When you have to export the comments from the database you can use this short snippet to get the schema as markup.

The output should be something like

Table name

table description

column name, type, description

….. the next table

Running chef kitchen with cookbook dependencies

Berksfile

metadata.rb

 

Restrict /manage or /admin in Rails

You can do it from the Ruby on Rails application or even better way is to do it where you define your infrastructure and configure your proxy/loadbalancer etc. to allow it.

 

mdadm: Duplicate MD device names in conf file where found.

remove the doublicate file from /etc/mdadm/mdadm.conf

Make sure the raid is up

Load the lvm volumes

  • -a – activate
  • -y – complete

exit to try the changes

Now you system will boot

Making the changes permanent

Fix the /etc/mdadm/mdadm.conf file by removing the duplicate definition.

If you are still in initramfs busybox

Cheat

mdadm –detail /dev/md0 mdadm –detail /dev/md1

mdadm –detail –scan > /etc/mdadm/mdadm.conf

Stop an array & assemble array mdadm –stop /dev/md1

mdadm –assemble /dev/md0 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 mdadm –assemble /dev/md1 /dev/sda2 /dev/sdb2 /dev/sdc2 /dev/sdd2

 

38693387_2127079967530580_4018998239729549312_n (1)

Run kitchen with vaults

Way of testing kitchen with vaults

608bhtga3m_5v2so6hi74_vc102292

copy your data_bags/ and decrypted vaults/ content in a new folder containing the merged content from both folders.

Do not forget to add data_bags_test folder in .git_ignore.

 

image from www.wannapik.com

Online conference software aka meetings

If you want your developers and stuff to be happy please AVOID webex !

Webex is bad service

It has bad International connection. It doesn’t run on linux or unix and can’t be run in a browser. The IOS application is bad and doesn’t integrate with the links. The integration with the website and the calendars is bad. The website is slow and buggy and you can’t see the meeting on which you are invited. It is the worst of the software out there.

Zoom – It is like the webex. They look and feel the same one idea better, because it has client which can run in linux

Good one

https://www.bluejeans.com/ – works perfectly!

http://appear.in – free and great!

 

Sending a bunch of data to Zabbix with one request

One can send a bunch of key => values to zabbix with the zabbix-trapper items.

Using this nice article  as a base I have packed everthing in a class so that you can use it:

Example usage:

 

Tired of the old Rails scaffold?

Why Rails scaffold doesn’t work

The need to write a replacement of the Rails scaffold was because the build in one in Ruby on Rails:

  • Does not support namespaces on the controllers and the models it generates funny paths in the views and/or controllers
  • The native way to extend the Rails scaffold was changed frequently I have to spend hours tracing github issues
  • It uses the ugly scaffold.css and it generates it all the time breaking my styles
  • Does some freaky copy/paste optimizations in the controller to get the model. Scaffold should be a starting point from where with few deletes or add few lines of codes to make a usable screen.

The new approach

With scaffold_pico you can create your own pretty administration in a second.

  • No learning curve – if you know Rails you know it.
  • No 3rd party gems slowing your development/production startup times.
  • Clean code
  • Supports namespaces in the models and the controllers

There is also some sugar. With the pico_scaffold you can generate from the beginning fabricators and take care of N+1 by specifying joins/includes clauses. There is separation of the fields for index and editing. There is a search – almost every screen now days has search.

Supports Zurb Foundation, Materializecss CSS frameworks

Here is the github: https://github.com/gudata/scaffold_pico