Skip to content

Instantly share code, notes, and snippets.

@arosenhagen
arosenhagen / magento-code-snippets.md
Last active April 8, 2024 09:21
[magento] - code snippets

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@leplatrem
leplatrem / yourapp
Last active September 24, 2023 23:01
gunicorn virtualenv init.d script (could be simpler with upstart)
#! /bin/bash
### BEGIN INIT INFO
# Provides: yourapp
# Required-Start: nginx
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: The main django process
# Description: The gunicorn process that receives HTTP requests
# from nginx
@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"<<<<<|=====|>>>>>"`
@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
@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
@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"
@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'
@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
@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
@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