Skip to content

Instantly share code, notes, and snippets.

View grafikchaos's full-sized avatar

Josh J. grafikchaos

View GitHub Profile
@hopsoft
hopsoft / db.rake
Last active April 3, 2024 13:13
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@petemcw
petemcw / brew-instructions.sh
Last active March 27, 2024 15:59
Setup dnsmasq on Mac OS X
# Install `dnsmasq` and configure for *.test domains
$ brew install dnsmasq
$ vim /usr/local/etc/dnsmasq.conf
# Reload configuration and clear cache
$ sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
$ dscacheutil -flushcache
@petemcw
petemcw / 01-README.md
Last active February 2, 2024 11:50
Mac OS X LEMP Configuration

Mac OS X LEMP Configuration

This Gist is a collection of configuration files that can be used to easily setup a Homebrew-based LEMP stack on Mac OS X.

Files in this repository are numbered and named for ordering purposes only. At the top of each file is a section of metadata that denote what component the file belongs to and the default name & location of the file. Feel free to implement it however you want.

Note: some configuration files have hard-coded paths to my user directory -- fix it for your setup

Setup

@krisanalfa
krisanalfa / macosx-install-php-oracle-oci8-pdo_oci.md
Last active January 11, 2024 22:00 — forked from gido/macosx-install-php-oracle-oci8.md
Install OCI8 and / or PDO_OCI on OSX via Brew

Installation

This procedure is tested on Mac OS X 10.10.5 with Developpers tools installed (xCode).

PHP 5.6 installed with Homebrew.

Preparation

Download the following files from Oracle website (yes, you need to create an account and accept terms):

@danmackinlay
danmackinlay / supervisord.sh
Created August 27, 2009 07:07
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@aleron75
aleron75 / shell_delete_unused_images
Last active October 24, 2023 19:59
Delete no more used Product Images on Magento 1
<?php
require_once 'abstract.php';
class Mage_Shell_CheckImages extends Mage_Shell_Abstract
{
const CATALOG_PRODUCT = '/catalog/product';
const CACHE = '/cache/';
protected function _glob_recursive($pattern, $flags = 0)
@peterjaap
peterjaap / Magento generated events
Created October 14, 2013 09:44
Magento generated events; a number of models use automatically generated events through prefixes. This is a (non-exhaustive) list of a number of those events, combined with _save_before, _save_after, _save_commit_after, _delete_before, _delete_after, _delete_commit_after, _load_before & _load_after.
tag_save_after
admin_roles_save_after
admin_user_save_after
review_save_after
catalogsearch_query_save_after
sales_order_save_after
sales_quote_address_save_after
sales_quote_payment_save_after
sales_quote_item_save_after
sales_quote_save_after
@frozenminds
frozenminds / clean-magento_ce-db-extended.sql
Created May 12, 2014 12:54
Clean Magento database of junk and unnecessary data
--
-- Magento CE database clean-up extended
--
-- This is an extended clean-up which will clean search, import/export, reports, etc.
--
-- @author Constantin Bejenaru <boby@frozenminds.com>
-- @copyright Copyright (c) Constantin Bejenaru (http://frozenminds.com/)
-- @license http://www.opensource.org/licenses/mit-license.html MIT License
--
@watson
watson / ability.rb
Created October 5, 2011 09:50
Active Admin CanCan integration with shared front/backend User model and multi-level autherization
# app/models/ability.rb
# All front end users are authorized using this class
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
can :read, :all
@olistik
olistik / gist:2627011
Last active August 12, 2021 06:39
Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)

Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)

Basic pre-requisites

  • Some utilities:
sudo apt-get install vim tmux git curl
  • Copy/paste from the command line: