Skip to content

Instantly share code, notes, and snippets.

View edgarsandi's full-sized avatar
👋
Hi there

Edgar R. Sandi edgarsandi

👋
Hi there
View GitHub Profile
@edgarsandi
edgarsandi / gist:6302898
Last active August 31, 2022 18:23 — forked from fluxsauce/gist:5282006
install from phpbrew
# Make sure the prerequisites are installed.
sudo apt-get -y install autoconf automake curl build-essential libxslt1-dev re2c libxml2-dev bison
# If don't have installed php use:
sudo apt-get install php5 php5-dev php-pear php5-mysql php5-intl php5-mcrypt php5-sqlite php5-xdebug php5-xmlrpc php5-xsl php5-xcache php5-memcache libxslt1-dev
# Install php archiver
sudo pear install PHP_Archive-alpha
# Install PHP 5 dependencies.
@edgarsandi
edgarsandi / draw.php
Last active December 30, 2015 09:39 — forked from omerida/draw.php
(New FIFA rule added)
<?php
/*
* World Cup Draw Example.
*
* Using Array functions & SPL Iterators to simulate (simplified) World Cup draws.
*
* @author Oscar Merida <[email protected]>
* @author Edgar Sandi <[email protected]> (New FIFA rule added)
*/
@edgarsandi
edgarsandi / ansible_conditionals_examples.yaml
Created August 10, 2016 22:17 — forked from marcusphi/ansible_conditionals_examples.yaml
Ansible 1.3 Conditional Execution -- Very complete example with comments -- I find the conditional expressions to be ridiculously hard to get right in Ansible. I don't have a good model of what's going on under the surface so I often get it wrong. What makes it even harder is that there has been at least three different variants over the course …
---
# This has been tested with ansible 1.3 with these commands:
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=false"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=true"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts"
# NB: The type of the variable is crucial!
- name: Ansible Conditionals Examples
hosts: $hosts
vars_files:
@edgarsandi
edgarsandi / slack_deploy_bot_template.py
Created August 21, 2016 01:16 — forked from achauve/slack_deploy_bot_template.py
Template of Slack bot for deployment
import logging
import os
import time
import traceback
# pip install slackclient
from slackclient import SlackClient
@edgarsandi
edgarsandi / new_relic_alert.sh
Created September 5, 2016 21:59 — forked from lichti/new_relic_alert.sh
Script to enable or disable newrelic alerts
#!/bin/bash
if [ ! -x /usr/bin/curl ]; then
echo "Please install curl"
exit 1
fi
if [ ! -x /usr/bin/jq ]; then
echo "Please install jq"
exit 1

I recently got a new Macbook Pro and wanted to document how I setup my PHP environment. I like full control of how PHP is built and I usually build it from source. I do this because I often add custom extensions and modules not found in the common PHP OSX installers. If your looking for a easier method than building from source try https://php-osx.liip.ch/.

NOTE: This post assumes you are running a fresh install of MacOS Sierra 10.12.2 with System Integrity Protection disabled. If you don't know how to disable it just boot into recovery mode and open a terminal and type csrutil disable, or google search it :) This post also assumes you are using Zsh instead of Bash shell. If you are using Bash you can replace anytime you see ~/.zshrc with ~/.bashrc.

First lets get some of the prerequisites. Start by grabbing the command line tools neccessary:

xcode-select --install
@edgarsandi
edgarsandi / gist:362f91433407a483d55cea91b3075291
Created March 6, 2017 14:30 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat

Quick install PHP 7.0:

1. Install depends PHP 7.0
$ brew install autoconf automake gmp homebrew/versions/bison27 gd freetype t1lib gettext zlib mcrypt
2. Configure PHP 7.0
$ git clone --depth=1 https://github.com/php/php-src.git

$ cd php-src

@edgarsandi
edgarsandi / configure_docker0.sh
Created May 4, 2017 19:36
Change the IP subnet of Docker's docker0 interface
#!/bin/sh -e
#
# You can run this script directly from github as root like this:
# curl -sS https://gist.githubusercontent.com/fabiorphp/a94e0ea2558b3d10185d6d69d053c2b2/raw/configure_docker0.sh | sudo bash -s - 172.31.0.21/16
#
# * Make sure you replace "192.168.254.0/24" with the network that you want to use
#
# NOTE: This script is intended for Debian / Ubuntu only!
if [ $# -lt 1 ]; then
@edgarsandi
edgarsandi / Dockerfile
Created February 28, 2018 03:58 — forked from SammyK/Dockerfile
Writing tests for php-src: Docker setup
FROM ubuntu:16.04
MAINTAINER Sammy Kaye Powers
RUN apt-get update \
&& apt-get install sudo vim git -y \
&& apt-get install build-essential autoconf valgrind -y \
&& apt-get install re2c bison -y \
&& apt-get install libxml2-dev locales lcov -y