Skip to content

Instantly share code, notes, and snippets.

View mr-chetan's full-sized avatar
🏠
Working from home

Chetan mr-chetan

🏠
Working from home
View GitHub Profile
@mr-chetan
mr-chetan / macos.md
Created May 6, 2026 08:30 — forked from sickcodes/macos.md
MacOS Defaults
# Forked from https://gist.github.com/gguerini
# Syntax edits by Sick Codes (GPLv3+)

# Disable menu bar transparency
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false

# Show remaining battery time; hide percentage
defaults write com.apple.menuextra.battery ShowPercent -string "NO"
defaults write com.apple.menuextra.battery ShowTime -string "YES"
sudo apt update
sudo apt install certbot python3-certbot-apache
sudo vim /etc/apache2/sites-available/your_domain.com.conf
sudo apache2ctl configtest
sudo systemctl reload apache2
@mr-chetan
mr-chetan / database_backup.sh
Created January 26, 2026 15:41 — forked from ajayfroiden/database_backup.sh
Database Backup and upload to s3 and delete old backups from local server
#!/bin/bash
# Database Backup Script
# This script performs MySQL database backups and uploads them to AWS S3
# Created: 2024
#
# Prerequisites:
# - MySQL/MariaDB installed
# - AWS CLI configured with appropriate credentials
# - Sufficient permissions on the backup directory
@mr-chetan
mr-chetan / iam-permissions-policy
Created April 9, 2025 10:10 — forked from ajayfroiden/iam-permissions-policy
Bucket Permission Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetObject",
"s3:ListBucket",
"s3:PutObject",
@mr-chetan
mr-chetan / nokia-router-cfg-tool.py
Created September 22, 2024 05:40 — forked from rajkosto/nokia-router-cfg-tool.py
Nokia/Alcatel-Lucent router backup configuration tool
#!/usr/bin/env python3
#
# Nokia/Alcatel-Lucent router backup configuration tool
# G2425 support added by rajkosto on 20/11/2022
# XS-2426G-B support added by rajkosto on 28/02/2023
#
# Features:
# - Unpack/repack .cfg files generated from the backup and restore functionnality
@mr-chetan
mr-chetan / LaravelWhereLikeMacro.php
Created November 26, 2023 07:32 — forked from MrPunyapal/LaravelWhereLikeMacro.php
Laravel Custom 'whereLike' Macro for Dynamic 'LIKE' Searches including relationships
<?php
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Arr;
class AppServiceProvider extends ServiceProvider
{
// ...
@mr-chetan
mr-chetan / import-sql.md
Created September 15, 2023 17:02 — forked from ankurk91/import-sql.md
MySQL/Postgresql: Import database via command line

Import large database to MySql ⚡

cd /path/to/backups
mysql -u root -h 127.0.0.1 -p --default-character-set=utf8
# Switch to database 
USE database_name;
@mr-chetan
mr-chetan / example-virtual-host.ssl.test.conf
Created September 15, 2023 17:01 — forked from ankurk91/example-virtual-host.ssl.test.conf
Sample virtual host .conf file for Apache2 on Ubuntu
# This to be used when you need to implement SSL
# Make sure that apache mod_ssl is on
# You can generate self signed certificates for development
# http://www.selfsignedcertificate.com/
<VirtualHost *:443>
ServerName yourapp.test
#ServerAlias www.yourapp.test
@mr-chetan
mr-chetan / dnsmasq.md
Created September 15, 2023 17:01 — forked from ankurk91/dnsmasq.md
DNSmasq on Ubuntu 18/20

DNSmasq wildcard on Ubuntu 18/20

  • Install dnsmasq
sudo apt install -y dnsmasq
sudo apt install -y resolvconf
  • 💡 The dnsmasq service will fail to start, you can ignore those errors for timebeing
  • Disable the default systemd-resolved service
@mr-chetan
mr-chetan / git-fetch-all.sh
Last active May 8, 2024 16:50
This script is use to fetch all the branches from all the repositories in the current directory
# !/bin/bash
# shell script text colors
BLACK='\033[0;30m'
RED='\033[0;31m'
GREEN='\033[0;32m'
BROWN='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'