Skip to content

Instantly share code, notes, and snippets.

View AGelzer's full-sized avatar
🎯
Focusing

Alexander Gelzer AGelzer

🎯
Focusing
  • eCommerce Werkstatt GmbH
  • Germany, Bad Salzuflen
View GitHub Profile
Show all commits that are in oldbranch, but not in new branch
git log --no-merges oldbranch ^newbranch
@AGelzer
AGelzer / Update git fork with tags.sh
Created December 17, 2022 16:18 — forked from Saissaken/Update git fork with tags.sh
Update git fork with tags
# Repo: someuser/myframework
# Fork: superteam/myframework
# Track:
git clone https://github.com/superteam/myframework.git
cd myframework
git remote add upstream https://github.com/someuser/myframework.git
# Update:
git fetch upstream
@AGelzer
AGelzer / 0: Magento 1.12 Enterprise multi-store cluster configuration.md
Created September 28, 2022 07:45 — forked from parhamr/0: Magento 1.12 Enterprise multi-store cluster configuration.md
A highly available, fault tolerant, distributed, and load balanced LEMP cluster.
@AGelzer
AGelzer / hash.h
Created April 6, 2022 08:36 — forked from hmic/hash.h
php hash function "from the source"
/*
* DJBX33A (Daniel J. Bernstein, Times 33 with Addition)
*
* This is Daniel J. Bernstein's popular `times 33' hash function as
* posted by him years ago on comp.lang.c. It basically uses a function
* like ``hash(i) = hash(i-1) * 33 + str[i]''. This is one of the best
* known hash functions for strings. Because it is both computed very
* fast and distributes very well.
*
* The magic of number 33, i.e. why it works better than many other
@AGelzer
AGelzer / README.md
Created February 9, 2022 12:21 — forked from pfrenssen/README.md
Git hook to check coding standards using PHP CodeSniffer before pushing

About

This is a git pre-push hook intended to help developers keep their PHP code base clean by performing a scan with PHP CodeSniffer whenever new code is pushed to the repository. When any coding standards violations are present the push is rejected, allowing the developer to fix the code before making it public.

To increase performance only the changed files are checked when new code is

@AGelzer
AGelzer / Install-Magento-1.md
Created April 29, 2021 13:48 — forked from rafaelstz/Install-Magento-1.md
Install Magento 1.9 (With Sample Data)
  
  ## Magento 1 + SampleData
  
  sudo apt-get update && \
  sudo apt-get install -y git wget unzip
  
  git clone https://github.com/OpenMage/magento-mirror.git ./ ;

  wget https://raw.githubusercontent.com/Vinai/compressed-magento-sample-data/1.9.1.0/compressed-magento-sample-data-1.9.1.0.tgz ;
@AGelzer
AGelzer / xdebug-cron.md
Created January 15, 2021 23:34 — forked from rodde177/xdebug-cron.md
Running Xdebug with cron jobs

Preconditions:

In command line, run following command first time (with same server name as configured in PHPStorm):

export PHP_IDE_CONFIG="serverName=localhost.tld" export XDEBUG_CONFIG="idekey=PHPSTORM"

@AGelzer
AGelzer / deploy.sh
Created January 14, 2021 10:53
Minimal Race-free Deployment
#!/bin/sh
# deploy.sh
N="`readlink \"$1\"`"
mv -T "$1.stage" "$1"
ln -s "$N" "$1.stage"
rm -rf "$N"
cp -aH "$1" "$N"

Zero downtime deploys with unicorn + nginx + runit + rvm + chef

Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).

Other application notes:

  • Our application uses MongoDB, so we don't have database migrations to worry about as with MySQL or postgresql. That does not mean that we won't have to worry about issues with the database with indexes being built in MongoDB or what have you.
  • We use capistrano for deployment.

Salient points for each file:

@AGelzer
AGelzer / 0. nginx_setup.sh
Created January 14, 2021 10:51 — forked from mikhailov/0. nginx_setup.sh
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#