Skip to content

Instantly share code, notes, and snippets.

View asvignesh's full-sized avatar

Vignesh A Sathiyanantham asvignesh

View GitHub Profile
@asvignesh
asvignesh / change_recovery_model_full.ps1
Created May 9, 2019 07:39
Powershell Script to change the recovery model of the databases to FULL
$dbs = Get-SqlDatabase -ServerInstance NW1\CLUST2
foreach ($database in $dbs | where { $_.IsSystemObject -eq $False })
{
$dbName = $database.Name
$sql = @"
USE [master]
GO
ALTER DATABASE [$dbName] SET RECOVERY FULL WITH NO_WAIT
GO
"@
Connect-VIServer -Server vcenter.asvignesh.in -Credential
$ovfPath = "C:\Users\asvig\Downloads\nimesa.ova"
$ovfConfig = Get-OvfConfiguration -Ovf $ovfPath
$ovfConfig.Common.ip.Value="10.10.x.x"
$ovfConfig.Common.netmask.Value="255.255.0.0"
$ovfConfig.Common.gateway.Value="10.0.0.1"
$ovfConfig.Common.dns1.Value="8.8.4.4"
$ovfConfig.Common.dns2.Value="8.8.8.8"
$ovfConfig.NetworkMapping.VM_Network.Value="VM Network"
@asvignesh
asvignesh / vm_from_template.yml
Created June 5, 2019 07:42
Provision vSphere VM from Template on Ansible
- hosts: localhost
connection: local
tasks:
- name: Clone VM from Template
- vmware_guest:
hostname: vcenter.asvignesh.in
username: administrator@asvignesh.in
password: password
validate_certs: no
name: newvm001
@asvignesh
asvignesh / CustomAuthentication.java
Created August 13, 2019 05:19
Spring boot REST Security
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
/**
@asvignesh
asvignesh / Nimesa Role.json
Created August 21, 2019 17:00
Nimesa IAM Role
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:CopySnapshot",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:ModifyVolumeAttribute",
@asvignesh
asvignesh / mysql-post.py
Last active August 31, 2019 15:51
MySQL Application consistent backup for Nimesa
import MySQLdb
import os
import time
import datetime
dt=datetime.datetime.now().strftime("%I:%M%p on %B %d, %Y")
file1 = open("/scripts/post-thaw.log","a+" )
try:
os.remove('/tmp/freeze_snap.lock')
@asvignesh
asvignesh / oracle_post.sh
Created February 8, 2020 12:27
Oracle database pre and post script for Nimesa
export ORACLE_HOME=/oracle/oracle11g
$ORACLE_HOME/bin/sqlplus / as sysdba <<EOF
spool $ORACLE_HOME/log/backup.log;
alter database end backup;
spool off;
EOF
@asvignesh
asvignesh / IAM Role.json
Created March 8, 2020 14:51
Create EC2 Consistent Backup
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "1",
"Effect": "Allow",
"Action": [
"ec2:CreateSnapshot",
"ec2:CreateTags",
"ec2:DescribeInstanceAttribute"
@asvignesh
asvignesh / ConfigurationServiceApplication.java
Created March 22, 2020 14:32
Spring Boot Config Server
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
@EnableConfigServer
@SpringBootApplication
public class ConfigurationServiceApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigurationServiceApplication.class, args);
}
@asvignesh
asvignesh / ClientBean.java
Created March 22, 2020 14:52
Spring Boot Config Client
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class ClientBean {
@Value("${k1}")
private String k1;
public String getK1() {