Skip to content

Instantly share code, notes, and snippets.

View brahmbhattsnehal's full-sized avatar

Snehal Brahmbhatt brahmbhattsnehal

View GitHub Profile
@brahmbhattsnehal
brahmbhattsnehal / pre-commit
Created March 3, 2022 19:09
Pre-commit hook for git with phpcs and phpcbf (auto-correct obvious violations)
#!/bin/sh
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
# Determine if a file list is passed
if [ "$#" -eq 1 ]
then
oIFS=$IFS
IFS='
@brahmbhattsnehal
brahmbhattsnehal / php-syntax-pre-commit.sh
Created March 3, 2022 18:47 — forked from carlbennett/php-syntax-pre-commit.sh
Checks for PHP syntax errors in a git pre-commit hook
#!/bin/bash
# Load the PHP environment so we can use php.
source /opt/remi/php72/enable
if [ -z "$PHP_BIN" ]
then
PHP_BIN=php
fi
@brahmbhattsnehal
brahmbhattsnehal / .htaccess
Created September 7, 2020 22:13 — forked from vielhuber/.htaccess
htpasswd protection wordpress exclude wp-json rest #wordpress #server
SetEnvIf Request_URI "^/wp-json/" allow_path
Order Deny,Allow
AuthType Basic
AuthName "Interner Bereich"
AuthUserFile /path/to/.htpasswd
AuthGroupFile /dev/null
require valid-user
Deny from all
Allow from env=allow_path
Satisfy any
@brahmbhattsnehal
brahmbhattsnehal / generate-ssh-key.sh
Created September 7, 2020 21:06 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa