Skip to content

Instantly share code, notes, and snippets.

@shebin512
shebin512 / send-email.sh
Last active February 16, 2021 20:20
cUrl Send email using SMTP
source ./sendEmailCurl-v1.1.sh # OR ./sendEmailCurl-v1.0.sh
EMAILTO='user1@example.com,user2@test1.com' \
EMAILSUBJECT="Test EMAIL $(date +%F)" \
EMAILBODY="This is a test email from $(HOSTNAME)\n USER $(USER)" \
sendEmail "$@"
exit 0
@rafaelstz
rafaelstz / magedeploy.sh
Created May 12, 2020 21:35
Magento 2 Deploy script
#!/usr/bin/env bash
LANGUAGES="en_US pt_BR"
# production or developer
ENVIRONMENT="production"
COMPOSER=$(which composer)
PHP=$(which php)
ROOT=$(pwd)
@geekgunda
geekgunda / aws-mfa-access.sh
Last active June 6, 2024 02:25
aws-cli MFA access via assume role
#!/bin/bash
# Assumption:
# 1. Your original AWS Creds should be stored at ~/.aws/credentials
# 2. You've corrected ARN for MFA device (search for FIXME)
# 3. You've given correct MFA Code as cli argument
# 4. You have jq installed. Ref: https://stedolan.github.io/jq/
if [ "$1" == "" ]; then
echo "Usage: `basename "$0"` <MFA-TOKEN>"
exit
@Yousha
Yousha / .gitattributes
Last active March 8, 2023 11:17
.gitattributes for PHP developers.
* text=auto
###### Git
.gitattributes text
.gitignore text
.gitconfig text
.gitmodules text
##### Windows
*.bat text eol=crlf
@voluntas
voluntas / sysctl.conf
Created October 14, 2017 13:07 — forked from techgaun/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
@exAspArk
exAspArk / curl.sh
Last active May 28, 2024 06:43
Test CORS with cURL
curl -I -X OPTIONS \
-H "Origin: http://EXAMPLE.COM" \
-H 'Access-Control-Request-Method: GET' \
http://EXAMPLE.COM/SOMETHING 2>&1 | grep 'Access-Control-Allow-Origin'
@ahadsheriff
ahadsheriff / addUsers.py
Last active December 14, 2022 03:49
Python script to add users to Linux groups.
"""
Author: Ahad Sheriff
Description:
Python script to add users to Linux groups. You can easily change the content
of this script to fit your needs.
Sample CSV file that I used to test is
included as `sampleAccounts.csv`
Data:
The data in the csv file must be of the form:
"Full Name", "Office Number", "Phone Extension #", "Department Name"
@yozik04
yozik04 / Dockerfile
Created November 24, 2016 14:32
PHP 7 fpm, alpine, mongodb and composer
FROM php:7-fpm-alpine
RUN apk --update add --virtual build-dependencies build-base openssl-dev autoconf \
&& pecl install mongodb \
&& docker-php-ext-enable mongodb \
&& apk del build-dependencies build-base openssl-dev autoconf \
&& rm -rf /var/cache/apk/*
# Time Zone
RUN echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini
@daniilyar
daniilyar / check-aws-snapshots-not-attached-to-any-ami.sh
Last active October 25, 2023 11:09
AWS: check if there is no orphaned EBS snapshots (orphaned == not attached to any 'available' AMI)
#!/bin/bash
set -e
AWS_ACCOUNT_ID=<ENTER_YOUR_ACCOUNT_ID_HERE>
REGION=us-west-2
ORPHANED_SNAPSHOTS_COUNT_LIMIT=10
WORK_DIR=/tmp
@maxmarkus
maxmarkus / pre-commit-hook-merge-conflicts.sh
Created March 24, 2016 13:26
Git pre-commit hook to prevent checking in non-resolved merge conflicts.
#!/bin/bash
# Check for merge conflicts
# Tested on Linux and Mac
# Simple check for merge conflics
conflicts=`git diff --cached --name-only -G"<<<<<|=====|>>>>>"`