Skip to content

Instantly share code, notes, and snippets.

View gmirsky's full-sized avatar

Gregory Mirsky gmirsky

View GitHub Profile
@gmirsky
gmirsky / dmidecode.txt
Created July 26, 2017 23:00
Is the server physical or a VM? If VM what type of VM?
VMware Workstation
======================================
$sudo dmidecode -s system-product-name
Output ==> VMware Virtual Platform
VirtualBox
======================================
$sudo dmidecode -s system-product-name
@gmirsky
gmirsky / addUsersWithTemporaryPasswordToGroup.sh
Created March 28, 2019 15:39
Add users with temporary password to group
#!/bin/bash
#
#
# Run as root or sudo su
#
#set -x
if [ "$EUID" -ne 0 ]; then
echo "This script requires elevated permissions."
echo "Please run this script as sudo or root."
exit
@gmirsky
gmirsky / AWSListUnUsedKeyPairs.ps1
Created January 7, 2020 14:54
PowerShell script to find unused AWS EC2 Key Pairs
Param( $AWSRegion = 'us-east-1', $AWSProfileName = 'default')
#
# Store your AWS credentials using the following Powershell AWS command:
#
# Set-AWSCredentials -AccessKey {xx} -SecretKey {xx} -StoreAs {MyProfileName}
#
# Example:
#
# Set-AWSCredentials -AccessKey 'AKIAVJL...OB4XN' -SecretKey 'oxLcrpnd3S+...8e2Me' -StoreAs 'testprofile'
# Set-DefaultAWSRegion us-east-1
@gmirsky
gmirsky / GrafanaDockerInstallAmazonLinux.md
Created April 21, 2020 20:33
Grafana Docker Container install on a AWS Amazon Linux 2 server

Grafana Docker Container install on a AWS Amazon Linux 2 server

This document will guide you through building a Amazon Linux 2 Server to serve as a docker host for a Grafana container that will power your server.

Prerequisites:

  • Local server to create files
  • AWS CLI access to the AWS account you want to deploy to in a bash shell console.
  • VPN access to the AWS account private subnet (or web console access via the AWS console)
  • A provisioned Amazon Linux 2 server with a static IP with an A-Record in DNS. A t3.small or larger is recommended.
@gmirsky
gmirsky / ZabbixDockerCompose.md
Created April 23, 2020 19:51
HOW-TO: Install Zabbix with MySQL as containers using docker-compose

HOW-TO: Install Zabbix with MySQL as containers using docker-compose

Provision EC2 instance

Provision Amazon Linux 2 EC2 with static IP and ports 22, 80, 443 and 10051 open in the security group.

Install docker

sudo yum update -y
@gmirsky
gmirsky / icanhazip-hcl.txt
Last active September 2, 2024 21:55
terraform get my ip address
data "http" "icanhazip" {
url = "http://icanhazip.com"
}
output "my_terraform_environmnet_public_ip" {
value = "${chomp(data.http.icanhazip.body)}"
}
@gmirsky
gmirsky / terraformWorkspaceName.txt.txt
Created June 23, 2020 21:23
terraform get workspace name
output "workspace_name" {
value = "${lower(terraform.workspace)}"
description = "Terraform Workspace Name"
sensitive = false
}
@gmirsky
gmirsky / aws_caller_identity.txt.txt
Created June 24, 2020 18:20
terraform get current user id
data "aws_caller_identity" "current" {}
output "account_id" {
value = "${data.aws_caller_identity.current.account_id}"
}
output "caller_arn" {
value = "${data.aws_caller_identity.current.arn}"
}
@gmirsky
gmirsky / dockerfile-dot-net.txt
Created June 30, 2020 18:13
Dockerfile for .NET Framework image with WindowsServerCore
# escape=`
# use .NET Framework image with WindowsServerCore
FROM mcr.microsoft.com/dotnet/framework/runtime:4.8
WORKDIR /app
# copy published application files inside the image
COPY _artifacts/appfiles /.
# configure web servers to bind to port 80 when present
ENV ASPNETCORE_URLS=http://+:80 `
@gmirsky
gmirsky / docker-update-all.sh.sh
Created July 1, 2020 14:54
update all docker images
docker images | grep -v REPOSITORY | awk '{print $1}' | xargs -L1 docker pull