Skip to content

Instantly share code, notes, and snippets.

View shahmimajid's full-sized avatar

Shahmi Majid shahmimajid

  • Malaysia
View GitHub Profile
@shahmimajid
shahmimajid / awsclidescribeec2
Last active September 20, 2019 07:58
awscli-command-describe instance
aws ec2 describe-instances --query 'Reservations[].Instances[].{Name:Tags[?Key==`Name`]|[0].Value,InstanceID:InstanceId,PrivateIP:PrivateIpAddress}' --output table --profile
# Add filter base on tagging
aws ec2 describe-instances --query 'Reservations[].Instances[].{Name:Tags[?Key==`Name`]|[0].Value,InstanceID:InstanceId,PrivateIP:PrivateIpAddress}' --filter "Name=tag:Environment,Values=tst" --output json --profile
@shahmimajid
shahmimajid / saltminion-install.sh
Created September 10, 2019 01:22
Install salt minion via AWS SSM using bashscript ( SLES 12SP4
#!/bin/bash
sudo zypper ref
sudo zypper install salt-minion -y
sudo systemctl start salt-minion.service
sudo systemctl enable salt-minion.service
@shahmimajid
shahmimajid / powershell_ssm_createcontent.ps1
Created April 5, 2019 07:04
Powershell - Copy file and append content
$cfpath = "C:\ProgramData\Amazon\AmazonCloudWatchAgent\common-config.toml"
$cfbackup = "C:\ProgramData\Amazon\AmazonCloudWatchAgent\common-config.toml_backup"
Copy-Item -Path $cfpath -Destination $cfbackup
$ProxyInfoToFile = @"
[proxy]
http_proxy = "myproxy"
https_proxy = "myproxy"
@shahmimajid
shahmimajid / listdbformssql.ps1
Created December 4, 2018 08:09
List MS SQL DB
Function Show-DatabasesOnServer
{
[CmdletBinding()]
param (
# Server Name or array of Server Names - Defaults to $ENV:COMPUTERNAME
[Parameter(Mandatory = $false,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true,
Position = 0)]
$Servers = $Env:COMPUTERNAME,
@shahmimajid
shahmimajid / README.md
Created November 14, 2018 04:01
All About SLES
@shahmimajid
shahmimajid / s3upload.bat
Created October 30, 2018 10:52
s3 recursive upload - linux & window
@ECHO OFF
:: Initialize the variables
SET S3BUCKET="smajidupload"
SET COPYPATH="C:\Users\Administrator\Downloads"
aws s3 cp %COPYPATH% s3://%S3BUCKET% --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --recursive
@shahmimajid
shahmimajid / setproxy.md
Last active October 16, 2018 03:18
HTTP-Proxy_bashscript

How To Set Proxy for all user in linux server

This is a simple bash script to configure proxy in linux server

Getting Started

These instructions will get you to setup proxy in all user via /etc/profile . There is two bash script to set proxy and unset proxy if needed.

Prerequisites

@shahmimajid
shahmimajid / k8_dailycommand
Last active August 11, 2018 09:34
Kubernetes Daily Use Command
# Port forward to local from Kubernetes pod port 80 to localhost port 8080
kubectl port-forward [pod name] 8080:80 .
# To check type of QoS for pods [ Guaranteed , Burstable , BestEffor]
kubectl get pod/nginx-pod -o jsonpath={.status.qosClass}
# To watch changes on pod
kubectl get pod -w
# The --record flag will track changes made through each revision
@shahmimajid
shahmimajid / README-Template.md
Created August 8, 2018 10:03 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@shahmimajid
shahmimajid / nodemcu-esp12 pin
Last active July 3, 2018 15:54
NodeMCU-esp12e GPIO PIN mapping to onboard pin
Mapping Pin to GPIO
static const uint8_t D0 = 16;
static const uint8_t D1 = 5;
static const uint8_t D2 = 4;
static const uint8_t D3 = 0;
static const uint8_t D4 = 2;
static const uint8_t D5 = 14;
static const uint8_t D6 = 12;
static const uint8_t D7 = 13;