Showing posts with label keys. Show all posts
Showing posts with label keys. Show all posts

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

Sunday, 5 January 2014

Macbook Air and Openbox: Raise/Lower Volume, Up/Down Brightness

    <keybind key="XF86KbdBrightnessUp">
      <action name="Execute">
        <command>xbacklight +10</command>
      </action>
    </keybind>
    <keybind key="XF86KbdBrightnessDown">
      <action name="Execute">
        <command>xbacklight -10</command>
      </action>
    </keybind>
    <keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
        <command>amixer -c 0 set Master 2dB+</command>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
        <command>amixer -c 0 set Master 2dB-</command>
      </action>
    </keybind>

Wednesday, 29 May 2013

Direct ssh to a server via proxy using putty/plink on Windows


  1. Make sure seamless ssh keys are setup to your bastion server for your username
    1. Not covered here
    2. See: http://www.ualberta.ca/CNS/RESEARCH/LinuxClusters/pka-putty.html
  2. Session -> Host Name -> mytargetserver.mydomain.com
  3. Connection -> Proxy
    1. Proxy Type -> Local
    2. Telnet command, or local proxy command 
      1. c:/program files (x86)/putty/plink.exe myproxy.mydomain.com -l myusername -agent -nc %host:%port
        1. adjust this path to plink.exe to match your local setup
          1. hint: install the complete putty install package, not just putty
  4. Tunnels
    1.   L8081 mytargetserver.mydomain.com:8081
Hint: always hit "Save", no matter what you do, or however inconvenient it was designed to be.

Another example: plink -L 127.0.0.1:1433:mysqlserver.com:1433 admin@google.com -i myprivkeyfile

Wednesday, 22 May 2013

LVM crypt disks on Linux/AWS



  1. dd if=/dev/urandom of=/keys/xvdm.key bs=1024 count=4
  2. dd if=/dev/urandom of=/keys/xvdn.key bs=1024 count=4
  3. cryptsetup --verbose -y luksFormat /dev/xvdm /keys/xvdm.key
  4. cryptsetup --verbose -y luksFormat /dev/xvdn /keys/xvdn.key
  5. cryptsetup luksOpen /dev/xvdm cryptm --key-file /etc/xvdm.key
  6. cryptsetup luksOpen /dev/xvdn cryptn --key-file /etc/xvdn.key
  7. pvcreate /dev/mapper/cryptm /dev/mapper/cryptn
  8. Add entries to /etc/crypttab for reboots and test somehow
    1. cryptm /dev/xvdm /etc/xvdm.key luks
    2. cryptn /dev/xvdn /etc/xvdn.key luks
Complete LVM setup and add entries to /etc/fstab.

Hint: don't make one, single typo...ever.

Wednesday, 13 March 2013

Get provisioned public key for AWS EC2 instance via curl

curl http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key

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