Skip to content

Instantly share code, notes, and snippets.

View Max95Cohen's full-sized avatar

Max Cohen Max95Cohen

View GitHub Profile
@Max95Cohen
Max95Cohen / example.conf
Last active January 20, 2023 03:36
example.conf apache2 virtual host config
<VirtualHost *:80>
CustomLog /path/access.log combined
DirectoryIndex index.php index.html
DocumentRoot /path
ErrorLog /path/error.log
ServerAlias www.example.com
ServerName example.com
<Directory /path>
Options -Indexes +FollowSymLinks
AllowOverride All
@Max95Cohen
Max95Cohen / update.sh
Last active August 7, 2023 08:18
update.sh apt update script
date
sudo apt update
apt list --upgradable
sudo apt -y upgrade
sudo apt autoclean
sudo apt autopurge
sudo apt autoremove --purge
if [ -f /var/run/reboot-required ]; then
echo 'reboot required'
@Max95Cohen
Max95Cohen / config.inc.php
Last active April 28, 2023 04:21
config.inc.php phpmyadmin config
$cfg['ShowDatabasesNavigationAsTree'] = true;
$cfg['ThemeDefault'] = 'original';
$cfg['Servers'][$i]['hide_db'] = '^(information_schema|performance_schema|mysql|phpmyadmin|sys)$';
$cfg['MaxNavigationItems'] = 500;
$cfg['TablePrimaryKeyOrder'] = 'desc';
$cfg['ProtectBinary'] = false;
$cfg['ShowBlob'] = true;
$cfg['NavigationDisplayLogo'] = false;
$cfg['NavigationTreeEnableGrouping'] = false;
@Max95Cohen
Max95Cohen / git.sh
Last active January 15, 2023 07:35
git.sh
git_branch=$(git branch --show-current 2>&1)
if [[ $git_branch == *"fatal:"* ]]
then export git_branch=''
else export git_branch="$git_branch"
fi
@Max95Cohen
Max95Cohen / navigation.js
Last active January 16, 2023 09:39
navigation.js phpmyadmin dist js file
js/navigation.js
$(document).on('keydown', (event) => {
if (event.ctrlKey && event.key === '\\') {
event.data = {'resize_handler': this};
this.collapse(event);
}
});
@Max95Cohen
Max95Cohen / plugins
Created January 19, 2023 14:02
Sublime Package controll: Install package
A File Icon
Emmet
Auto-save
HTML-CSS-JS Prettify
Pretty JSON
syncviewscroll
Inspired Github Color Theme
@Max95Cohen
Max95Cohen / .bashrc
Last active April 28, 2023 04:22
.bashrc update
wget https://gist.githubusercontent.com/Max95Cohen/7af5c9db2c003cb0c032265c77a14907/raw/1d51080f12a88846e6ff6188cace28c8cae58530/git.sh
wget https://gist.githubusercontent.com/Max95Cohen/e86448c0e258703d604c98992fb5e55d/raw/3c824eddd6f1b42dfc8b888510083e00dfe2b0c4/.vimrc
sed -i 's/ls --color=auto/ls --color=auto --group-directories-first/' .bashrc
sed -i '59i PROMPT_COMMAND="source /home/aibekq/git.sh";' .bashrc
sed -i '60i \ ' .bashrc
echo "PS1='${debian_chroot:+($debian_chroot)}[\e[0;33m\t\e[0m] \e[1;36m\w \e[0;30m\j \e[1;31m$git_branch\n\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\] $ '" >> .bashrc
echo "alias rm='rm -i';" >> .bashrc
echo "eval \$(ssh-agent);" >> .bashrc
@Max95Cohen
Max95Cohen / apt
Last active January 21, 2023 11:52
apt install command
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install \
git \
vim \
nano \
php8.1 php8.1-{cli,fpm,gd,zip,mbstring,mysql,dom,xml,curl,redis,memcached} \
php7.4 php7.4-{cli,fpm,gd,zip,mbstring,mysql,dom,xml,curl,redis,memcached} \
mysql-server-8.0 \
nginx
@Max95Cohen
Max95Cohen / _backup.sh
Created January 21, 2023 19:20
_backup.sh mysql backup script
# mysqldump requires at least the SELECT privilege for dumped tables, SHOW VIEW
# for dumped views, TRIGGER for dumped triggers, LOCK TABLES if the
# --single-transaction option is not used, and (as of MySQL 8.0.21) PROCESS if
# the --no-tablespaces option is not used. Certain options might require other
# privileges as noted in the option descriptions.
# .my.cnf
[mysqldump]
user=backup
password="PASSWORD"
@Max95Cohen
Max95Cohen / pre-commit
Created January 27, 2023 18:00
pre-commit git hook
#!/bin/bash
REGEX_ISSUE_ID="^((ISSUE|TASK)\-[0-9]+)"
ISSUE_ID_IN_BRANCH=$(echo $(git rev-parse --abbrev-ref HEAD) | grep -o -E "$REGEX_ISSUE_ID")
if [[ -z "$ISSUE_ID_IN_BRANCH" ]]; then
RED='\033[0;31m'
NC='\033[0m' # No Color