Skip to content

Instantly share code, notes, and snippets.

View goyalmohit's full-sized avatar

mohit goyal goyalmohit

  • Pune, India
View GitHub Profile
#update list of repositories
sudo apt-get update
#install jre and jdk
sudo apt-get install openjdk-8-jre
sudo apt-get install openjdk-8-jdk
#set export variables for java
export JAVA_HOME='/usr/lib/jvm/jre-1.8.0-openjdk'
export JRE_HOME='/usr/lib/jvm/java-8-openjdk-amd64/jre'
#update list of repositories
sudo yum update
sudo reboot
#install jdk
sudo yum install java-1.8.0-openjdk.x86_64
#set export variables for java
export JAVA_HOME='/usr/lib/jvm/jre-1.8.0-openjdk'
export JRE_HOME='/usr/lib/jvm/java-8-openjdk-amd64/jre'
@goyalmohit
goyalmohit / New-RandomPassword.ps1
Last active April 16, 2017 09:18
Generate random password using PowerShell
#function starts here
function New-RandomPassword()
{
#specifies the default maximum no of characters to be generated for password
#can be override by passing parameter values while calling function
param(
[int]$maxChars=8
)
@goyalmohit
goyalmohit / install-powershell-core-on-ubuntu16.sh
Last active February 14, 2019 07:33
Install PowerShell Core on Ubuntu 16.04
# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# Register the Microsoft Ubuntu repository
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list
# Update apt-get
sudo apt-get update
# Install PowerShell
@goyalmohit
goyalmohit / install-powershell-core-on-centos-7.sh
Last active November 11, 2023 04:06
Install PowerShell Core on CentOS 7
# Enter superuser mode
sudo su
# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/microsoft.repo
# Exit superuser mode
exit
# Install PowerShell
@goyalmohit
goyalmohit / open-firewall-port-80-centos.sh
Last active April 16, 2017 09:17
Open firewall for port 80 on CentOS
#this command configure firewall to accept incoming tcp connections on port 80
firewall-cmd --zone=public --permanent --add-port=80/tcp
firewall-cmd --reload
@goyalmohit
goyalmohit / configure-ssl-for-jenkins-on-centos.sh
Last active February 29, 2024 22:36
Configure SSL for Jenkins on CentOS
#This gist is related to blog post https://mohitgoyal.co/2017/02/08/securing-your-jenkins-environment-and-configure-for-auditing/
# Generate certificate csr
openssl req -new > new.ssl.csr
# Create a key file for generating certificate
openssl rsa -in privkey.pem -out new.cert.key
# Create a csr file using the key file for 635 days
openssl x509 -in new.ssl.csr -out new.cert.cert -req -signkey new.cert.key -days 365
@goyalmohit
goyalmohit / read-multi-line-input-from-powershell.ps1
Last active April 16, 2017 09:15
Read multi line input from users in PowerShell using messagebox
# This script is used in a blog post on the https://mohitgoyal.co/2017/04/16/read-multi-line-input-from-users-in-powershell/. Please
# read the blog post for more information
function Read-MultiLineInputBoxDialog([string]$Message, [string]$WindowTitle, [string]$DefaultText)
{
Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms
# Create the Label.
$label = New-Object System.Windows.Forms.Label
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"firstArray": {
"type": "array",
"defaultValue": [
"1-1",
"1-2",
"1-3"
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.1.0",
"parameters": {
"firstArray": {
"type": "array",
"defaultValue": "1-1 1-2 1-3"
},
"secondArray": {
"type": "array",