Skip to content

Instantly share code, notes, and snippets.

View rsponholtz's full-sized avatar

Ross Sponholtz rsponholtz

  • @Azure Microsoft
  • Bellevue, WA
View GitHub Profile
@rsponholtz
rsponholtz / tmuxinst.sh
Last active April 14, 2020 02:26
install tmux on sles 12 sp 3
#!/bin/bash
zypper addrepo https://download.opensuse.org/repositories/home:/so_it_team:/12.x/SLE_12_SP3/home:so_it_team:12.x.repo
zypper addrepo https://download.opensuse.org/repositories/network:utilities/SLE_12_SP3/network:utilities.repo
zypper addrepo http://download.opensuse.org/repositories/home:/univest:/stable/SLE_12_SP3/home:univest:stable.repo
zypper addrepo http://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-12-SP4/standard/openSUSE:Backports:SLE-12-SP4.repo
zypper refresh
zypper install -y iperf tmux
@rsponholtz
rsponholtz / deleteunused.ps1
Created June 18, 2018 15:59
delete unused disks in azure
$subscriptionname = "mysubscription"
$resourcegroup = "myresourcegroup"
select-azurermsubscription -subscriptionname $subscriptionname
Get-AzureRmDisk -ResourceGroupName $resourcegroup | Where-Object {$_.ManagedBy -eq $Null} | remove-azurermdisk -force
@rsponholtz
rsponholtz / removecomments.sh
Created June 20, 2018 18:55
removecomments
#!/bin/bash
cat $1 | sed '/^#/ d' | sed '/^$/d'
[openlogic]
name=CentOS-$releasever - openlogic packages for $basearch
baseurl=http://olcentgbl.trafficmanager.net/openlogic/$releasever/openlogic/$basearch/
enabled=1
gpgcheck=0
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://olcentgbl.trafficmanager.net/centos/$releasever/os/$basearch/
@rsponholtz
rsponholtz / getipaddr.sh
Created November 4, 2018 20:35
get private ip address from azure metadata service
ipaddr=`curl -H Metadata:true "http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/privateIpAddress?api-version=2017-04-02&format=text"`
@rsponholtz
rsponholtz / custominfoscript.sh
Created March 2, 2019 00:31
custominfoscript
#!/bin/bash
whoami
pstree
pstree > /tmp/custominfo.log
uname -a
@rsponholtz
rsponholtz / metadata.sh
Last active April 20, 2020 21:57
azure metadata api examples
#get network info for VM
curl -H Metadata:true "http://169.254.169.254/metadata/instance/network?api-version=2017-08-01"
#get the subnet mask
curl -H Metadata:true "http://169.254.169.254/metadata/instance/network/interface/0/ipv4/subnet/0/prefix?api-version=2017-08-01&format=text"
#
curl -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2019-06-01"
#wget -cq http://jsonip.com/ -O - | jq '.'
#all metadata for instance, pretty printed
curl -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2019-06-01" | python -m json.tool