Skip to content

Instantly share code, notes, and snippets.

View OguzPastirmaci's full-sized avatar

Oguz Pastirmaci OguzPastirmaci

  • Oracle Cloud Infrastructure
  • Seattle, WA
  • 22:52 (UTC -07:00)
  • LinkedIn in/oguzpastirmaci
View GitHub Profile
@OguzPastirmaci
OguzPastirmaci / create-sas-azure-xplat.sh
Last active November 22, 2016 14:07
Simple shell script to create a Shared Access Signature (SAS) in Azure using Azure cross platform CLI
#!/bin/bash
# Enter the storage account that you want to create the SAS for.
storage_account_name="Enter your storage account name"
# Enter the container name that you want to create the SAS for.
container_name="Enter your container name"
# Sets the validity period of the SAS key to 1 hour. Should be in ISO 8601 format.
sas_ttl=$(date --utc --date "1 hour" +%FT%TZ)
@OguzPastirmaci
OguzPastirmaci / start-azure-vms.sh
Last active November 17, 2015 20:04
Shell script to start VMs using Azure cross-platform CLI
azure vm list | grep "Stopped" | awk '{system("azure vm start "$2)}'
@OguzPastirmaci
OguzPastirmaci / stop-azure-vms.sh
Created November 13, 2015 19:56
Shell script to shutdown VMs using Azure cross-platform CLI
azure vm list | grep "ReadyRole" | awk '{system("azure vm shutdown "$2)}'
@OguzPastirmaci
OguzPastirmaci / start-stop-azure-vms.sh
Last active September 7, 2017 09:17
Bash script that shows a menu to start or stop VMs using Azure cross-platfom CLI
#!/bin/bash
clear
echo ""
echo "-----------------------------------"
echo ""
echo "WHAT DO YOU WANT TO DO TODAY?"
echo ""
echo "1 - Start all the VMs"
echo "2 - Shutdown all the VMs"
oguzp@oguzp-agent1:~$ azure vm list
info: Executing command vm list
+ Getting virtual machines
data: Name Status Location DNS Name IP Address
data: -------------------- ------------------ ---------------- --------------------------------- ----------
data: oguzp-agent1 ReadyRole West US oguzp-agent1.cloudapp.net 172.16.0.4
data: oguzp-mrp StoppedDeallocated South Central US oguzp-mrp.cloudapp.net
data: oguzp-mrp2 StoppedDeallocated South Central US oguzp-mrp.cloudapp.net
data: oguzp-mrp3 StoppedDeallocated South Central US oguzp-mrp.cloudapp.net
data: oguzp-mesos StoppedDeallocated South Central US oguzp-mesos.cloudapp.net
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: omsagent
spec:
template:
metadata:
labels:
app: omsagent
spec:
# Add the records to ordering database on MongoDB
sudo mongo ordering /var/lib/partsunlimited/MongoRecords.js
# Change Tomcat listening port from 8080 to 9080
sudo sed -i s/8080/9080/g /etc/tomcat7/server.xml
# Remove existing MRP directory and copy WAR file to Tomcat directory for auto-deployment
sudo rm -rf /var/lib/tomcat7/webapps/mrp
sudo cp /var/lib/partsunlimited/mrp.war /var/lib/tomcat7/webapps
FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get install -y wget apt-utils
RUN sed -i.bak 's/101/0/' /usr/sbin/policy-rc.d
RUN wget https://app.deepsecurity.trendmicro.com:443/software/agent/Ubuntu_14.04/x86_64/ -O /tmp/agent.deb --quiet
RUN dpkg -i /tmp/agent.deb
RUN sleep 15
FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install -y wget apt-utils \
&& sed -i.bak 's/101/0/' /usr/sbin/policy-rc.d \
&& wget https://app.deepsecurity.trendmicro.com:443/software/agent/Ubuntu_14.04/x86_64/ -O /tmp/agent.deb --quiet \
&& dpkg -i /tmp/agent.deb \
&& sleep 15 \
# Replace with your Workspace ID
$CustomerId = ""
# Replace with your Primary Key
$SharedKey = ""
# Specify the name of the record type that you'll be creating
$LogType = "Minecraft"
# Specify a field with the created time for the records