Skip to content

Instantly share code, notes, and snippets.

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

JothiBasu jbontech

:octocat:
Focusing
View GitHub Profile
@jbontech
jbontech / CloudWatchAgentConfig.json
Created September 28, 2021 19:15 — forked from csereno/CloudWatchAgentConfig.json
AWS CloudWatch Agent configuration file example for Linux with standard /var/log/messages, secure, and yum logs
{
"agent": {
"metrics_collection_interval": 10,
"logfile": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log"
},
"metrics": {
"metrics_collected": {
"cpu": {
"resources": [
"*"
@jbontech
jbontech / postgres.service
Created September 21, 2021 19:34 — forked from BenHall/postgres.service
Docker Systemd Unit File
[Unit]
Description=PostgreSQL container
Requires=docker.service
After=docker.service
[Service]
Restart=on-failure
RestartSec=10
ExecStartPre=-/usr/bin/docker stop postgres
ExecStartPre=-/usr/bin/docker rm postgres
@jbontech
jbontech / Makefile
Created August 12, 2021 18:58 — forked from ryu1kn/Makefile
Encrypt/decrypt with AWS KMS using AWS cli
# How to encrypt/decrypt your text/blob secret with AWS KMS with AWS cli
KEY_ID=alias/my-key
SECRET_BLOB_PATH=fileb://my-secret-blob
SECRET_TEXT="my secret text"
ENCRYPTED_SECRET_AS_BLOB=encrypted_secret_blob
DECRYPTED_SECRET_AS_BLOB=decrypted_secret_blob # Result of decrypt-blob target
encrypt-text:
#!/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"