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) }

Wednesday, 22 July 2015

htop: save configuration

To exit htop and save config in file:

  F10

To find the config file just after you exit:

  find -name '*htoprc*' -mmin -10

Friday, 17 July 2015

Slow loading mysql dump into RDS

It's the PIOPS, stupid. Try cranking them up, e.g. 300GB volume at 3000 IOPS on your RDS instance when you create it.

See if that helps.

I just went from load taking days to load taking only hours.

This is an official AWS collection point for data, so please leave a comment on your experience. jk.

Thursday, 25 June 2015

create simple mysql table for testing

CREATE TABLE suppliers (
    SupplierID SMALLINT UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT,
    SupplierName VARCHAR(40) NOT NULL,
    Phone VARCHAR(14) NOT NULL,
    Email VARCHAR(60) NULL,
    PRIMARY KEY (SupplierID)
 );

INSERT INTO suppliers (SupplierName, Phone, Email) VALUES ('ABCSupplier','1122334455','abc@dicforum.com');

Monday, 22 June 2015

VirtualBox: port forwarding to guest from host

Something weird in the new (2015-06) version.


  • Network
    • Set "NAT"
    • Click "Port Forwarding"
    • "Insert new rule" (right-hand nav button)
      • Rule 1
        • Host IP: 127.0.0.1
        • Host port: 2222
        • Guest IP: [leave blank]
        • Guest Port: 22
To get to guest:

ssh -p 2222 myuser@localhost

where myuser is user you created when you installed Linux OS on to VM.

Monday, 1 June 2015

Connect to remote JMX over ssh and jconsole

ssh -N -f -D 7777 dev-cass-10.mydomain.internal

jconsole -J-DsocksProxyHost=localhost -J-DsocksProxyPort=7777 service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi

Friday, 22 May 2015

Stress Linux system: stress-ng

worthy: stress-ng

NOTE: it's the newer/better version of "stress"

Quote:

stress-ng current contains the following methods to exercise the machine:
  • CPU compute - just lots of sqrt() operations on pseudo-random values. One can also specify the % loading of the CPUs
  • Cache thrashing, a naive cache read/write exerciser
  • Drive stress by writing and removing many temporary files
  • Process creation and termination, just lots of fork() + exit() calls
  • I/O syncs, just forcing lots of sync() calls
  • VM stress via mmap(), memory write and munmap()
  • Pipe I/O, large pipe writes and reads that exercise pipe, copying and context switching
  • Socket stressing, much like the pipe I/O test but using sockets
  • Context switching between a pair of producer and consumer processes

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