Skip to content

Instantly share code, notes, and snippets.

@joshribakoff
joshribakoff / Vagrantfile
Created October 11, 2017 20:06 — forked from stephenreay/Vagrantfile
Local file override for Memory/CPU limits in Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby
if File.exists?('./Vagrantfile.override.rb')
require_relative './Vagrantfile.override.rb'
end
# Defaults for CPU and Memory
CPUS ||= 1
MEMORY ||= 1024
<!DOCTYPE html>
<?php
if(file_exists(__DIR__.'/config.php')) {
$configuration = require __DIR__ . '/config.php';
} else {
$configuration = require __DIR__ . '/config.dist.php';
}
session_start();
if(isset($configuration['environment']) && $configuration['environment'] == 'dev') {
- name: Install apache2 and php etc
apt: name={{ item }} state=present
with_items:
- apache2
notify:
- restart apache
- name: update apache ports.conf
synchronize:
src: ../vagrant-production/apache2/ports.conf
RUNNING HANDLER [restart apache] ***********************************************
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/service.py
<default> ESTABLISH LOCAL CONNECTION FOR USER: vagrant
<default> EXEC /bin/sh -c 'echo ~ && sleep 0'
<default> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/vagrant/.ansible/tmp/ansible-tmp-1500439923.22-278690191575535 `" && echo ansible-tmp-1500439923.22-278690191575535="` echo /home/vagrant/.ansible/tmp/ansible-tmp-1500439923.22-278690191575535 `" ) && sleep 0'
<default> PUT /tmp/tmphV7b7H TO /home/vagrant/.ansible/tmp/ansible-tmp-1500439923.22-278690191575535/service.py
<default> EXEC /bin/sh -c 'chmod u+x /home/vagrant/.ansible/tmp/ansible-tmp-1500439923.22-278690191575535/ /home/vagrant/.ansible/tmp/ansible-tmp-1500439923.22-278690191575535/service.py && sleep 0'
<default> EXEC /bin/sh -c '/usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1500439923.22-278690191575535/service.py; rm -rf "/home/vagrant/.ansible/tmp/ansible-tmp-1
---
- hosts: all
vars:
http_port: 80
max_clients: 200
tasks:
#- {script: /vagrant/bootstrap.sh, become: yes}
#- {include: roles/common/tasks/common.yml, become: yes}
@joshribakoff
joshribakoff / gist:6905615
Created October 9, 2013 18:10
How to test a magento class thru command line for Ozzy
<?php
require_once 'app/Mage.php';
Mage::app('admin','store');
// this class is loaded in app/code/local/Paquin/Ozzy.php
$ozzy = new Paquin_Ozzy('json2.json');
var_dump($ozzy->categoryIdsToShow());
@joshribakoff
joshribakoff / gist:6852699
Created October 6, 2013 11:13
debug vf table
print_r($this->getReadAdapter()->query('select * from elite_1_definition')->fetchAll());
@joshribakoff
joshribakoff / gist:6852259
Last active December 24, 2015 19:39
Shorten the docblocks, multi file recursive multi-line find & replace
<?php
/** Enable blash globbing, or run with zsh instead of bash */
`ls **/*.php > list.txt`;
$find = "/**
* Vehicle Fits (http://www.vehiclefits.com for more information.)
* @copyright Copyright (c) Vehicle Fits, llc
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/";
@joshribakoff
joshribakoff / gist:6827222
Created October 4, 2013 14:50
Split 2 magento stores, in an almost atomic operation
# Edit your vhosts, and then reload apache immediatly after this script completes.
mysqldump --user=root magento_live > magento_new.sql
rsync -avr path/to/live/ path/to/new
mysql --user=root -e "create database magento_new"
mysql --user=root magento_new < magento_new.sql
@joshribakoff
joshribakoff / gist:6753429
Created September 29, 2013 15:27
Moving test files
<?php
function main($dir)
{
foreach(glob($dir.'/*') as $dir) {
// if this is a test file / folder
if(preg_match('/Test(.php)?/', $dir)) {
$newFile = "tests/VF" . str_replace('library/VF', '', $dir);
$newPath = dirname($newFile);
`mkdir -p $newPath`;
`mv $dir $newFile`;