Skip to content

Instantly share code, notes, and snippets.

@elfeffe
elfeffe / odoo9_ubuntu 14.04.txt
Last active February 1, 2017 11:38
Odoo 9 Ubuntu 14.04 (with upgrade to 10)
Odoo 9
https://www.linode.com/docs/websites/cms/install-odoo-9-erp-on-ubuntu-14-04
To change to 10 just need to pull master from GIT
git clone https://github.com/odoo/odoo.git
To install nginx as a proxy
<?php
namespace App\Engines;
use Laravel\Scout\Engines\AlgoliaEngine;
use Log;
class AdvancedAlgoliaEngine extends AlgoliaEngine
{
protected $index;
find /var/www/ -name \*.php | xargs grep -l "ALREADY_RUN_1bc29b36f342a82aaf6658785356718" | xargs rm
@elfeffe
elfeffe / gist:d1f882368330d46ee7c53b88bcdc685b
Created January 26, 2019 15:10
Move MySql Database from one server to another in one single line
mysqldump db_name | mysql -h 'other_hostname' db_name
@elfeffe
elfeffe / app--code--local--Varien--Autoload.php
Created April 18, 2019 17:17 — forked from lstrojny/app--code--local--Varien--Autoload.php
Replace Magento autoloader with composer based autoloader. Note: you are losing the ability to use the compiler.
<?php
/**
* Classes source autoload
*/
class Varien_Autoload
{
/** @var \Composer\Autoload\ClassLoader */
private static $autoloader;
/** @var self */
<?php
namespace App\Libraries\Queue;
use Illuminate\Events\Dispatcher;
use Illuminate\Queue\DatabaseQueue;
use Illuminate\Support\Str;
use Laravel\Horizon\Events\JobDeleted;
use Laravel\Horizon\Events\JobPushed;
use Laravel\Horizon\Events\JobReleased;
@elfeffe
elfeffe / gist:9c7804d26e4aa2d4759ee25b616f1690
Created August 6, 2019 16:20
Ubuntu resize images recursively if they are over 1mb
find . -type f -name "*.jpg" -size +1000k -exec mogrify -resize 1024x1024\> -strip -resample 80 {} \;
Original: https://www.webfoobar.com/node/38
Pagespeed Nginx configuration
Create Pagespeed global configuration:
mkdir -p /etc/nginx/apps/pagespeed
vi /etc/nginx/apps/pagespeed/core.conf
@elfeffe
elfeffe / show-indexes.js
Created February 10, 2020 23:43 — forked from wpottier/show-indexes.js
MongoDB copy indexes
db.getCollectionNames().forEach(function(collection) {
indexes = db[collection].getIndexes();
indexes.forEach(function (c) {
opt = '';
ixkey = JSON.stringify(c.key, null, 1).replace(/(\r\n|\n|\r)/gm,"");
ns = c.ns.substr(c.ns.indexOf(".") + 1, c.ns.length);
for (var key in c) {
if (key != 'key' && key != 'ns' && key != 'v') {
if (opt != '') { opt+= ','}
if (c.hasOwnProperty(key)) {
@elfeffe
elfeffe / gist:ee5dbd2b19e1f5f2a3760026b7cbef10
Created February 11, 2020 04:05
Move MongoDB collection to another server oneliner version
mongodump -v --archive --uri="mongodb://localhost:27017/DB_NAME" | mongorestore -v --archive -d DB_NAME --nsFrom DB_NAME.* --nsTo DB_NAME.* --uri="mongodb://DEST_IP:27017/DB_NAME"