Friday 8 September 2017

Multiple SSH Keys settings for different github accounts

Say you have two keys. Add these two keys as following to ssh agent running on your local machine:

 $ ssh-add ~/.ssh/id_rsa_hacker
 $ ssh-add ~/.ssh/id_rsa_exchan

You can check your saved keys

 $ ssh-add -l

Sample ssh config settings, uses aliases in first line of blocks

 Host github-hacker
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa_hacker

 Host github-exchan
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa_exchan

then use normal flow to push your code

git clone git@github.com:hacker/myrepo.git

set remote host from the default (github.com) to match alias in the ssh config

git remote set-url origin git@github-hacker:hacker/myrepo.git
you can see the change in .git/config file if you look carefully
git add .
git commit -m "your comments" git push

Monday 4 September 2017

Docker training on Mac, 001


Take these steps, and, afterwards, try to understand how and why they worked, including flags/options "passed into" the command.
  • install Docker for Mac
    • verify install
      • docker --version
    • run basic container test
      • docker run hello-world
  • install iTerm2
    • open a terminal window and split horizontally, then close
    • open a terminal window and split vertically, then close
  • run webserver
    • open a terminal window and split horizontal
    • in bottom pane, run: 
      • watch -d -n7 docker ps -a
      • as you take steps below, watch what changes occur in this window
    • in top window, run:
      • docker run -d -p 8080:80 --name mywebserver001 nginx
    • open this in your web browser
      • http://localhost:8080
  • shut it down
    • docker stop mywebserver001
    • docker rm mywebserver001

Monday 20 March 2017

Linux boot process

There seems to be a strong interest when interviewing in this process.

  • bios
    • stands for: basic input / output system
    • does system integrity checks
    • find and runs MBR boot loader program
  • mbr
    • located on first sector of bootable disk
    • under 512 bytes, 3 parts
      • primary boot loader info (446 bytes)
      • disk partition info (64 bytes)
      • mbr validation check (last 2 bytes)
    • contains info on GRUB
    • summary: loads and exec GRUB
  • grub
  • kernel
  • init
  • runlevel

Thursday 9 March 2017

System Services Migrating from Operations Teams to The Cloud

Done, or in process to some degree.
  • system installs
  • disk formatting
  • volume management
  • database replication
  • monitoring tools
  • service start / stop
  • service start / stop scripts
  • backup automation

Wednesday 25 January 2017

fizzbuzz in ruby

#!/usr/bin/env ruby

(1..100).each do |num|
  three = (num % 3 == 0)
  five = (num % 5 == 0)
  print 'fizz' if three
  print 'buzz' if five
  print num if (!three and !five)
  puts
end

Tuesday 24 January 2017

Docker: simple example, fast

See github link for instructions on how to run.

docker-compose.yml

version: '2'
services:
    app:
        build:
            context: ./
            dockerfile: app.docker
        ports:
            - "80:80"

app.docker

FROM silintl/ubuntu:16.04

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update
RUN apt-get install -y apache2

WORKDIR /var/www/humankind

RUN echo " \n\
 \n\
    ServerName humankind \n\
    DocumentRoot /var/www/humankind \n\
 \n\
" >> /etc/apache2/sites-available/humankind.conf

RUN a2dissite 000-default.conf && a2ensite humankind.conf

RUN echo "Automation for the People" > /var/www/humankind/index.html

EXPOSE 80
CMD ["apache2ctl", "-D", "FOREGROUND"]

See: https://github.com/pcleddy/mini001

Interview questions: 2020-12

Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer  Networking Layer 1 vs Layer 4 haproxy u...