Script to open a pull request on github from the current branch

When you push a new branch to GitHub from the command line, you’ll notice a URL within the output which you can copy in order to quickly open a new pull request.

But if you are on old branch…then nothing will help you.

And I was tired opening the github website so…. here it is a small ruby script which opens my browser at the correct place in github.

 

This version supports sub-modules

The meaning of “phlpwcspweb3” or why you should not do abbreviations in the code

“phlpwcspweb3”  is found at the “Amazon Web Services – Tagging Best Practices

From what I see this is something related to web, and probably there are at least 3 instances of that kind.

According to AWS this should be meaningful hostname.

If you have decoded this you probably do not need to read further….

Continue reading “The meaning of “phlpwcspweb3” or why you should not do abbreviations in the code”

HTTPS Connections counting

Here is how one can setup a nginx to count the https connections made.

Preparation

Create a new folder

Put a dummy entry in your /etc/hosts file

Steps

First generate certificate

create a new file something.conf with the following content

Then run the docker with

Get the cacert

And finally do some connections

 

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)