Skip to content

Instantly share code, notes, and snippets.

View awaxa's full-sized avatar

Greg Kitson awaxa

View GitHub Profile
ENVIRONMENT="$1"
test_CNT="thing1 thing2 thing3"
beta_CNT="thing4 thing5 thing6"
varname=${ENVIRONMENT}_CNT
for i in ${!varname}; do
echo $i
done
####
echo -n 'CPU Temperatures (Celsius): '
for thermal_zone in thermal_zone3 thermal_zone4 ; do
echo -n "$(echo 'scale=1;' $(cat /sys/class/thermal/$thermal_zone/temp) '/1000' | bc) "
done
echo
#!/usr/bin/env bash
# before running this script:
# manually assign a hostname in System Preferences/Sharing
# optionally, set external facts github_token_ro and github_token_rw
set -evx
sudo mkdir -p /etc/puppetlabs/{puppet,facter/facts.d}
export PATH=$PATH:$HOME/.gem/ruby/2.0.0/bin
awaxa@air:~/tmp $ curl -s --head http://www.yahoo.com | head -n 1 | xxd
00000000: 4854 5450 2f31 2e31 2033 3031 2052 6564 HTTP/1.1 301 Red
00000010: 6972 6563 740d 0a irect..
class ntp {
package { 'ntp':
ensure => present,
}
file { '/etc/ntp.conf':
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/ntp/ntp.conf',
#!/usr/bin/env sh
iptables -F
iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
iptables -A INPUT -j DROP
@awaxa
awaxa / -
Created December 31, 2015 04:46
Device Identifier: disk2
Device Node: /dev/disk2
Whole: Yes
Part of Whole: disk2
Device / Media Name: WD My Passport 0741 Media
Volume Name: Not applicable (no file system)
Mounted: Not applicable (no file system)
rescued: 1868 GB, errsize: 0 B, current rate: 0 B/s
ipos: 1879 GB, errors: 0, average rate: 2423 kB/s
opos: 1879 GB, run time: 8d 22h 7m, remaining time: n/a
time since last successful read: 6d 10h 9m
Copying non-tried blocks... Pass 3 (forwards)
@awaxa
awaxa / outlet
Last active December 18, 2019 07:16
apc pdu outlet expect script
#!/usr/bin/expect
set timeout 3
if {[llength $argv] == 0} {
send_user "Usage: outlet [1-8] [on|off] \n"
exit 1
}
set number [lindex $argv 0]
set onoff [lindex $argv 1]
@awaxa
awaxa / lamp_on.exp
Last active December 22, 2015 13:22
apc ap7900 outlet control
#!/usr/bin/expect
set timeout 3
spawn telnet pdu
expect "User Name :" { send "apc\r" }
expect "Password :" { send "apc\r" }
# device manager