Skip to content

Instantly share code, notes, and snippets.

Avatar

Nadjmou BOINA boina-n

View GitHub Profile
@boina-n
boina-n / Hawq-cups
Last active Jan 27, 2017
How to create a user provided service with an external Hawq DB
View Hawq-cups
vboxmanage list vms
vboxmanage import /opt/application/PCF-BDS/HDB-Sandbox-2.01-vbox.ova
VBoxManage modifyvm "HDB-Sandbox-2.01-vbox" --natpf1 delete http
VBoxManage modifyvm "HDB-Sandbox-2.01-vbox" --natpf1 "http,tcp,,8888,,80"
VBoxManage modifyvm "HDB-Sandbox-2.01-vbox" --natpf1 delete gpdb
@boina-n
boina-n / Install Cloud Foundry Usage report from source
Last active Jan 27, 2017
Install the Cloud Foundry usage report plugin
View Install Cloud Foundry Usage report from source
## How to install the Cloud Foundry usage report plugin for the CLI:
wget https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz
tar -zxvf go1.7.4.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.7.4.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go get github.com/cloudfoundry/cli
mkdir $HOME/work
export GOPATH=$HOME/work
go get github.com/cloudfoundry/cli
go get github.com/krujos/usagereport-plugin
@boina-n
boina-n / proxy-gradlew
Created Jan 27, 2017
Set a proxy with gradlew to build a project
View proxy-gradlew
git clone https://github.com/kgshukla/hawqdb-service-broker.git
./gradlew -Dhttp.proxyHost=12.34.56.78 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=12.34.56.78 -Dhttps.proxyPort=3129 build
@boina-n
boina-n / virtualbox-snapshot-clone.txt
Last active Feb 20, 2017
virtualbox snapshot and clone commands
View virtualbox-snapshot-clone.txt
#!/bin/bash
rm -rf /opt/application/PCF-DEV/pcfdev/clones/$(date +"%Y%m%d" --date="+2 days ago").pcfdev-v0.389.0
vboxmanage clonevm pcfdev-v0.389.0 --basefolder /opt/application/PCF-DEV/pcfdev/clones/ --name $(date +"%Y%m%d").pcfdev-v0.389.0
# 1. Take a snapshot
vboxmanage snapshot pcfdev-v0.389.0 take $(date +"%Y%m%d").pcfdev-v0.389.0
# 2. Clone the Snapshot
vboxmanage clonevm pcfdev-v0.389.0 --snapshot $(date +"%Y%m%d").pcfdev-v0.389.0 --basefolder /opt/application/PCF-DEV/pcfdev/clones/ --name $(date +"%Y%m%d").pcfdev-v0.389.0
View io_disk-measurement.txt
vcap@agent-id-pcfdev-0:~$ while true ; do iostat -p sda -x ; sleep 1 ;done
Linux 4.2.0-42-generic (agent-id-pcfdev-0) 02/09/2017 _x86_64_ (16 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.80 0.00 4.49 0.10 0.00 94.61
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.19 28.61 4.30 15.53 262.87 1166.64 144.22 1.07 53.79 19.09 63.40 3.64 7.21
sda1 0.19 28.61 4.28 15.37 262.78 1166.64 145.49 1.06 54.18 19.17 63.93 3.65 7.18
sda2 0.00 0.00 0.01 0.00 0.04 0.00 8.34 0.00 0.34 0.34 0.00 0.34 0.00
@boina-n
boina-n / Pivotal file_download_api.txt
Last active Oct 3, 2017
Pivotal file_download_api
View Pivotal file_download_api.txt
apikey=YourApiKeyhere
filename=pcfdev-v0.24.0+PCF1.9.0-linux.zip
url=https://network.pivotal.io/api/v2/products/pcfdev/releases/4027/product_files/12667/download
wget -O $filename --header="Authorization: Token $apikey" $url
# If you are behind a proxy:
curl -x http://myproxyaddress:port --proxy-user username:password' -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token $apikey" -X GET $url -o $filename
@boina-n
boina-n / gencfscript.txt
Last active Feb 21, 2017
This java program will create a script to recreate all the ressources of you Cloud Foundry installation (Account, orgs, spacs, quotas etc...)
View gencfscript.txt
export MAVEN_OPTS="-Dhttps.proxyHost=1.2.3.4 -Dhttps.proxyPort=3128"
./mvnw clean package
mkdir -p /root/script/cfbackup
java -jar target/gencfscript-0.0.2-SNAPSHOT.jar http://api.pcfdev admin admin --skip-ssl-validation --hideProgress > /root/script/cfbackup/$(date +"%Y%m%d").cfbackup.sh
0 0 * * * /root/script/usagereport.sh &>/dev/null
@boina-n
boina-n / smtp-telnet.sh
Last active Nov 12, 2019
Use telnet to send email with an attachement
View smtp-telnet.sh
#!/bin/bash
filename="/path/to/your/file.log"
subject="Subject of my email"
txtmessage="This is the message I want to send"
{
sleep 1;
echo "EHLO mydomain.intra"
sleep 1;
@boina-n
boina-n / pcfdev-monitoring.sh
Created Apr 6, 2017
Simple script to quickly to monitor pcfdev
View pcfdev-monitoring.sh
#!/bin/bash
date=$(date +%d/%m/%y)
daterev=$(date +%Y%m%d)
timestamp=$(date +%s)
dir=/home/vcap/pcfdev-check
if [ ! -d "$dir" ]; then
mkdir -p $dir
fi
@boina-n
boina-n / android-tethering.sh
Last active Apr 8, 2017
Enable android tethering with Ubuntu
View android-tethering.sh
#!/bin/bash
sudo ip route delete default
sudo ifconfig usb0 up
sudo dhclient usb0
sudo ip route add default via 192.168.42.129
You can’t perform that action at this time.