Skip to content

Instantly share code, notes, and snippets.

View jbontech's full-sized avatar
:octocat:
Focusing

Jothibasu jbontech

:octocat:
Focusing
View GitHub Profile
#!/bin/bash
FILE=/home/ubuntu/mysql_backup/mysql-credentials.cnf
if [ -f "$FILE" ]; then
echo "$FILE exists."
rm $FILE
else
echo "$FILE does not exist."
fi
credentialsFile=/home/ubuntu/mysql_backup/mysql-credentials.cnf
# Let us consider the following typical mysql backup script:
mysqldump --routines --no-data -h $mysqlHost -P $mysqlPort -u $mysqlUser -p$mysqlPassword $database
# It succeeds but stderr will get:
# Warning: Using a password on the command line interface can be insecure.
# You can fix this with the below hack:
credentialsFile=/mysql-credentials.cnf
echo "[client]" > $credentialsFile
echo "user=$mysqlUser" >> $credentialsFile
echo "password=$mysqlPassword" >> $credentialsFile
@jbontech
jbontech / gitlab-api.py
Created May 7, 2021 19:48
Python Gitlab API example
import yaml
import gitlab
from prettytable import PrettyTable
#############################
# THIS SCRIPT WILL PRINT THE SHORT COMMIT_ID,AUTHOR,DATE,TITLE OF COMMIT FROM GITLAB API
##############################
###########################################################################################
# 1. Create the personal access token in the gitlab profile settings then user in th eprivate_token
Key Sublime Text 3.2.1 Build 3207
----- BEGIN LICENSE -----
Member J2TeaM
Single User License
EA7E-1011316
D7DA350E 1B8B0760 972F8B60 F3E64036
B9B4E234 F356F38F 0AD1E3B7 0E9C5FAD
FA0A2ABE 25F65BD8 D51458E5 3923CE80
87428428 79079A01 AA69F319 A1AF29A4
A684C2DC 0B1583D4 19CBD290 217618CD
# -*- mode: ruby -*-
# vi: set ft=ruby :
$init = <<-SHELL
yum update -y
# SELinux 無効
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config
# firewall 無効
systemctl disable --now firewalld
@jbontech
jbontech / kvmtemplate.sh
Created November 26, 2020 13:58 — forked from jverdeyen/kvmtemplate.sh
KVM template
#!/bin/bash
name=beta
disk=4096
swap=1024
mem=4096
suite=precise
ip="192.168.199.199"
cpu=8
@jbontech
jbontech / autossh
Created November 24, 2020 08:34 — forked from spiroski/autossh
Script alternative to autossh
#!/bin/bash
# ------------------------------------------------------------------------------
# FILE: autossh
# DESCRIPTION: This is an SSH-D proxy with auto-reconnect on disconnect
# AUTHOR: Hector Nguyen (hectornguyen at octopius dot com)
# VERSION: 1.0.0
# ------------------------------------------------------------------------------
VERSION="1.0.0"
GITHUB="https://github.com/hectornguyen/autossh"
AUTHOR="Hector Nguyen"
#!/bin/bash
# exit when the command fails
set -o errexit;
# exit when try to use undeclared var
set -o nounset;
accessKeyToSearch=${1?"Usage: bash $0 AccessKeyId"}
@jbontech
jbontech / Vagrantfile
Created August 27, 2020 03:17 — forked from adejoux/Vagrantfile
vagrant chef configuration file
#use libvirt
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'libvirt'
VMCOUNT = (ENV['VMCOUNT'] || 1).to_i
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.5.0"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "virtualbox"
@jbontech
jbontech / updateSonarProps.sh
Created August 26, 2020 10:21 — forked from giehlman/updateSonarProps.sh
Update SonarQube properties file with project name and version from package.json
#!/usr/bin/env bash
#title : updateSonarProps.sh
#description :
# This script parses the project's name and version from its package.json and automagically
# updates the version and package name in the SonarQube configuration properties file.
# It can be used as a pre step before running the sonar-scanner command
# It also creates a backup of the props file with suffix *.bak
#prerequisites : NodeJS based project with package.json, sonar*.properties file in the cwd
#author : Christian-André Giehl <christian@emailbrief.de>
#date : 20180220