Skip to content

Instantly share code, notes, and snippets.

View wesfloyd's full-sized avatar

Wes Floyd wesfloyd

View GitHub Profile
@fernandoaleman
fernandoaleman / Linux Static IP
Created March 23, 2012 16:20
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
function startWait(){
curl -s -u $user:$pass -H 'X-Requested-By: ambari' -X PUT -d \
'{"RequestInfo": {"context" :"Start '"$1"' via REST"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}' \
http://$host/api/v1/clusters/$cluster/services/$1
wait $1 "STARTED"
}
function stopWait(){
curl -s -u $user:$pass -H 'X-Requested-By: ambari' -X PUT -d \
'{"RequestInfo": {"context" :"Stop '"$1"' via REST"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' \
@jdye64
jdye64 / HWXSandboxKerberos.sh
Last active August 29, 2015 14:19
CentOS Kerberos KDC Installation
#!/bin/bash
#To use this script directly in the Hortonworks Sandbox I use this command
#wget https://gist.github.com/jdye64/76d4dc92018c3e613f66/download -O hwx_sand_krb.tar.gz && tar zxvf ./hwx_sand_krb.tar.gz -C ./. --strip-components=1 && chmod 777 ./HWXSandboxKerberos.sh && ./HWXSandboxKerberos.sh
#Case sensitive. This will bite you if not careful
#KDC Host - sandbox.hortonworks.com
#Realm Name - HORTONWORKS.COM
#Domains - .hortonworks.com,hortonworks.com
#kadmin host - sandbox.hortonworks.com
@JustinShenk
JustinShenk / idle-shutdown.sh
Last active August 15, 2024 13:17
Google Cloud Platform (GCP) instance idle shutdown
#!/bin/bash
# Add to instance metadata with `gcloud compute instances add-metadata \
# instance-name --metadata-from-file startup-script=idle-shutdown.sh` and reboot
# NOTE: requires `bc`, eg, sudo apt-get install bc
# Modified from https://stackoverflow.com/questions/30556920/how-can-i-automatically-kill-idle-gce-instances-based-on-cpu-usage
threshold=0.1
count=0
wait_minutes=60
while true