Thursday 29 December 2016

simple angularjs 1.x webapp

Here's a very simple app using AngularJS 1.x.

Hints:

  • Ignore how the first couple of lines in app.js work, and just use as is.
  • Anything in index.html that starts with "ng-" is a "angular directive", fancy term for a placeholder. Angular repeatly scans the DOM for these, gulps them up and runs them. Sometimes it is just a div, sometimes the whole body. You decide how much of the DOM a directive needs to control. Try to keep it as small as possible.

Code: https://github.com/pcleddy/wordcounter
Live app: http://bit.ly/2iiEuoY (I hope)

Maybe try to play with app.js to see if you can add some functionality using m_words.

Friday 29 April 2016

git: merge request


  • git checkout master
  • git pull
  • git branch -b <mybranch>
  • <changes>
  • git commit -am'My change commit'
  • git push origin <mybranch>

Wednesday 27 April 2016

Ubuntu LXD container: no IP address

sudo dpkg-reconfigure -p medium lxd

Be very careful, this will wipe any existing lxc/lxd bridge you have and make your existing containers unreachable. So this is really only recommended if you are using LXD for the first time on your machine.

See comment section of https://www.stgraber.org/2016/03/11/lxd-2-0-introduction-to-lxd-112/

"This change was required to be able to decouple LXD from the old LXC tools, moving it onto its own bridge. The warning message was highlighting the reasons for that, the effect it would have on existing containers and how to configure it so things would work as usual."

Tuesday 26 April 2016

openvpn confs - starpoint

server

port 1194
proto udp
dev tun0
ca ca.crt
cert server.crt
key server.key  # This file should be kept secret
dh dh1024.pem
server 192.168.100.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 10.0.0.0 255.0.0.0"
push "route 172.10.0.0 255.255.0.0"
push "route 172.11.0.0 255.255.0.0"
push "route 172.21.0.0 255.255.0.0"
push "route 172.25.0.0 255.255.0.0"
push "route 172.27.0.0 255.255.0.0"
push "route 172.28.0.0 255.255.0.0"
push "route 172.30.0.0 255.255.0.0"
push "route 172.31.0.0 255.255.0.0"
push "route 172.32.0.0 255.255.0.0"
push "route 172.40.0.0 255.255.0.0"
push "route 172.41.0.0 255.255.0.0"
push "route 172.42.0.0 255.255.0.0"
push "route 172.29.30.0 255.255.255.0"
push "route 172.29.27.0 255.255.255.0"
client-to-client
keepalive 10 120
tls-auth ta.key 0 # This file is secret
comp-lzo
max-clients 200
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 4
crl-verify crl.pem
management localhost 11111
plugin /usr/lib/openvpn/openvpn-plugin-auth-pam.so login
push "dhcp-option DNS 192.168.100.1"
push "dhcp-option DOMAIN slicetest.com"
reneg-sec 36000
client

client
dev tun
proto udp
remote vpn.vpcprod.mydomain.com 1194
resolv-retry infinite
nobind
user nobody
group nogroup
persist-key
persist-tun
ca ca_vpcprod.crt
cert client_vpcprod.crt
key client_vpcprod.key
ns-cert-type server
tls-auth ta_vpcprod.key 1
comp-lzo
verb 3
reneg-sec 36000

Saturday 16 April 2016

gist of git rebase problem avoidance

"If you treat rebasing as a way to clean up and work with commits before you push them, and if you only rebase commits that have never been available publicly, then you’ll be fine. If you rebase commits that have already been pushed publicly, and people may have based work on those commits, then you may be in for some frustrating trouble, and the scorn of your teammates."

https://git-scm.com/book/en/v2/Git-Branching-Rebasing

Wednesday 13 April 2016

absolute necessities for technical teams of diverse personality types


  1. change management
    1. for "real"
      1. using professional standards developed by large companies
      2. many government orgs use the standard
      3. existing tools may exist
      4. concepts definitely exist and are well documented
    2. repositories on all changed files
      1. who changed what when
        1. ability to lower repeated mistakes through good practices
    3. system for tracking pushes up environment chain
      1. dev -> qa -> staging -> prod
    4. garbage maintenance
      1. zero duplicate file name and/or paths
        1. requires code calling by old name/path be updated immediately
  2. process
    1. tracking
      1. modern ticketing system
    2. ownership
      1. tickets ownership changed as issues blocked by new owner
        1. ETAs alway updated on ownership change by new owner
    3. Gantt or similar mapping of tasks, milestone and dependencies
      1. daily updated charting by designated project manager
  3. information
    1. ownership
    2. responsibility
    3. single endpoint
  4. enforcement
    1. lack of enforcement leads to habitual pattern of ignoring policies and procedures
    2. some form of impartial performance quality must be developed
    3. repeated inability to meet ETAs must have measureable repercussions
  5. coding
    1. code reviews on any and all code everywhere
      1. random, cross team code reviews would be more effective
        1. so teams can learn from each other
    2. zero tolerance for outdated
      1. coding practices
      2. coding languages
        1. code must be updated to current standards

Tuesday 23 February 2016

Openvpn and unbound combined break dig command


  • when doing DNS lookup against remote unbound server over OpenVPN connection
    • results not coming back, or say "reply from unexpected source" 
    • ping and ssh work fine


  • fix unbound.conf 
    • "interface" parameter -> local ip instead of "0.0.0.0"
    • replies will have the local ip and not the OpenVPN ip now

Sample reply when still broken:

;; reply from unexpected source: 192.168.30.1#53, expected 172.30.1.54#53

Thursday 4 February 2016

SSH config: command for bastion server proxying


Host 51.21.21.11
  IdentityFile ~/.ssh/mykey.pem
  User ec2-user
  ForwardAgent yes

Host 10.*
  ProxyCommand ssh ec2-user@51.21.21.11 nc %h 22
  User ec2-user
  IdentityFile ~/.ssh/mykey.pem
  ForwardAgent yes

Put your ssh public key in ~/.ssh/authorized_keys along the path.

Tuesday 26 January 2016

Ruby: multi-level hash keys trick

Ruby freakshow to allow multi-level hash keys to be set even if they have not been defined before. Feature!

m_entities = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }

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...