Saturday 30 November 2013

Wednesday 27 November 2013

Chromecast tricks

  1. is casting a tab
    1. don't do full screen
      1. instead, shrink browser window to size of original video
        1. what is put on the screen is relative to the window size
        2. seems to save on bandwidth
          1. passed through your wireless router
          2. less broken stream therefore

Friday 8 November 2013

Building latest collectd on Amazon Linux server in AWS

  1. yum install byacc flex automake libtool libgcrypt-devel glib2-devel libtool-ltdl-devel perl-ExtUtils-MakeMaker
    1. comments below imply this may be necessary: apt-get install bison
  2. git clone https://github.com/collectd/collectd.git
  3. cd collectd
  4. ./build.sh
  5. ./configure
  6. make 
 Some helpful libs, start over to use them
  1. yum install lvm2-devel net-snmp-devel liboping-devel libpcap-devel libesmtp-devel libcurl-devel libmnl-devel
Dated: Nov, 2013

Openbox: monitor laptop battery via CLI and notify-send


while (true);do acpi -b | perl -n -e 's/.*?(\d+)%.*/$1/;chomp;print "$_...";if ($_ <= 15) {`notify-send batalert:$_`};';sleep 180;done

Would like a beep, but can't get one, no PC speaker on MacBook Air and mplayer buffers.

Wednesday 6 November 2013

Change X / Openbox screen brightness on CLI

  1. sudo apt-get -y install xbacklight
  2. xbacklight +10
  3. xbacklight +10
  4. xbacklight +10
  5. xbacklight -10
  6. xbacklight -10
  7. xbacklight -10

Tuesday 5 November 2013

Recover wireless of Ubuntu on MacBook Air 4,2

  1. sudo apt-get --reinstall install bcmwl-kernel-source
  2. sudo modprobe -r b43 ssb wl brcmfmac brcmsmac bcma
  3. sudo modprobe wl
Broadcom 802.11 Linux STA wireless driver source

wicd: Could not connect to wicd's D-bus interface

I don't know why, she swallowed the fly.

After

  1. Wicd needs to access your computer's network cards
  2. Could not connect to wicd's D-Bus interface

Do

  1. sudo mv -v /etc/resolv.conf /etc/resolv.conf.backup
  2. sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf
  3. sudo rm -v /var/lib/wicd/resolv.conf.orig
  4. sudo service wicd start
  5. yum -y install wicd-gtk
  6. wicd-gtk

Saturday 2 November 2013

Zenoss on Amazon Linux

Someone saved my life tonight, Sugarbear: http://binarynature.blogspot.com/2012/11/zenoss-core-4-installation.html

Also taken: http://magazine.redhat.com/2007/12/04/hacking-rpms-with-rpmrebuild/

WARNING: USE AT OWN RISK
  1. remove non-critical, unmet dependencies in rpm
    1. get good version of rpmrebuild
      1. wget ftp://fr2.rpmfind.net/linux/opensuse/ports/update/12.3/noarch/rpmrebuild-2.9-7.4.1.noarch.rpm
      2. yum localinstall rpmrebuild-2.9-7.4.1.noarch.rpm
    2. wget http://downloads.sourceforge.net/project/zenoss/zenoss-4.2/zenoss-4.2.4/4.2.4-1897/zenoss_core-4.2.4-1897.el6.x86_64.rpm
    3. rpmrebuild -e -n -p zenoss_core-4.2.4-1897.el6.x86_64.rpm
      1. remove lines
        1. Requires:      libgcj
        2. %dir %attr(0755, root, root) "/etc/sudoers.d"
        3. # ensure that the system uses the /etc/sudoers.d directory
        4. SUDOERSD_TOKEN="#includedir /etc/sudoers.d"
        5. SUDOERSD_FOUND=`/bin/egrep "^$SUDOERSD_TOKEN" /etc/sudoers`
        6. if [ -z "$SUDOERSD_FOUND" ]; then
        7.    echo "# zenoss rpm, ensure that /etc/sudoers.d loads" >> /etc/sudoers
        8.    echo $SUDOERSD_TOKEN >> /etc/sudoers
        9. fi
      2. save file and "continue"
      3. note place resultant file is created, copy to local working directory
        1. if you can't find it where it is supposed to be
          1. yum -y install mlocate
          2. updatedb
          3. locate zenoss
  2. ntp
    1. ntpq -pn
    2. make sure ntp is installed and running
  3. java
    1. remove openjdk and install oracle java
      1. yum -y remove java jdk
      2. wget -N -O jre-6u31-linux-x64-rpm.bin http://javadl.sun.com/webapps/download/AutoDL?BundleId=59622
      3. chmod +x jre-6u31-linux-x64-rpm.bin
      4. ./jre-6u31-linux-x64-rpm.bin
    2. verify
      1. java -version
      2. echo $JAVA_HOME
    3. cover missing libgcj, not strictly necessary
      1. yum -y install ecj
      2. only for running java classes natively instead of using JVM
        1. about as obscure as it gets
  4. Add extra repos
    1. rpm --import http://dev.zenoss.org/yum/RPM-GPG-KEY-zenoss
    2. yum-config-manager --enable epel
    3. yum --nogpgcheck -y localinstall http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
  5. install some deps
    1. yum -y install memcached net-snmp
  6. start some dep services
    1. service memcached start
    2. service snmpd start
    3. chkconfig memcached on
    4. chkconfig snmpd on
  7. mysql
    1. yum -y install mysql-server
    2. service mysqld start
    3. chkconfig mysqld on
  8. install amazon linux compatible zenoss rpm you created above
    1. yum --nogpgcheck localinstall zenoss-4.2.4-1897.el6.x86_64.rpm
    2. echo > /opt/zenoss/var/zenpack_actions.txt
      1. you REALLY don't want these right now, install by-hand later
  9. start more dep services
    1. service rabbitmq-server start
    2. chkconfig rabbitmq-server on
  10. start and stop zenoss core, dbs and files are created
    1. service zenoss start;sleep 5;service zenoss stop
  11. post zenoss updates as zenoss user, then back to root user
    1. su -l zenoss
    2. wget --no-check-certificate https://raw.github.com/osu-sig/zenoss-autodeploy-4.2.3/master/secure_zenoss.sh
    3. sh secure_zenoss.sh
    4. egrep 'user|password' $ZENHOME/etc/global.conf | grep -v admin
    5. zodbpw=$(grep zodb-password $ZENHOME/etc/global.conf | awk '{print $2}')
    6. sed -i.orig "5s/zenoss/$zodbpw/" $ZENHOME/etc/zodb_db_{main,session}.conf
    7. tail -n +1 $ZENHOME/etc/zodb_db_{main,session}.conf
    8. exit
  12. set mysql password for zenoss user using password generated above
    1. mysql -u root -p
    2. SET PASSWORD FOR 'zenoss'@'localhost' = PASSWORD('18zmcTgYsA+AjczljwQd');
      1. sub your password in instead
  13. create zenoss user for rabbitmq
    1. vim set-rabbitmq-perms.sh
      1. grab code below and put in here
    2. sh set-rabbitmq-perms.sh
    3. service rabbitmq-server restart
  14. start zenoss final time
    1. service zenoss restart
    2. chkconfig zenoss on
    3. verify
      1. su -l zenoss -c 'zenoss status'
      2. rabbitmqctl -p /zenoss list_queues
  15. Add this line to the end of /etc/sudo.conf
    1. #includedir /etc/sudoers.d
    2. was removed during rpm tweak
NOTE: this is probably not perfect, but very close, please, send corrections

###################################################
## code for set-rabbitmq-perms.sh
#!/usr/bin/env bash
set -e
ZENHOME="/opt/zenoss"
VHOSTS="/zenoss"
USER="zenoss"
PASS="grep amqppassword \$ZENHOME/etc/global.conf | awk '{print \$2}'"
if [ $(id -u) -eq 0 ]
then
RABBITMQCTL=$(which rabbitmqctl)
$RABBITMQCTL stop_app
$RABBITMQCTL reset
$RABBITMQCTL start_app
$RABBITMQCTL add_user "$USER" "$(su -l zenoss -c "$PASS")"
for vhost in $VHOSTS; do
$RABBITMQCTL add_vhost "$vhost"
$RABBITMQCTL set_permissions -p "$vhost" "$USER" '.*' '.*' '.*'
done
exit 0
else
echo "Error: Run this script as the root user." >&2
exit 1

Listen to internet radio without Flash on Mac and Linux CLI

NOTE: nice classical music option! https://github.com/klutometis/radio/blob/master/radio.sh
  1. OS type
    1. Mac
      1. brew install mplayer
        1. See this if you hit the bug: https://github.com/mxcl/homebrew/issues/23503
    1. Linux (Debian-based)
      1. apt-get install mplayer
  2. play on CLI
    1. mplayer <stream>
      1. e.g. mplayer http://www.antenne.de/webradio/channels/das-schlager-karussell.m3u 
Or/else:
  1. paste stream link into a browser directly
  2. use VLC to play stream

Read ext4 on Mac


  1. install xcode
  2. install brew
  3. brew install ext4fuse
    1. follow any instructions on changing permissions
  4. ext4fuse <device> <mountpoint>

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