Skip to content

Instantly share code, notes, and snippets.

<?php
namespace App\Engines;
use Laravel\Scout\Engines\AlgoliaEngine;
use Log;
class AdvancedAlgoliaEngine extends AlgoliaEngine
{
protected $index;
@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
@elfeffe
elfeffe / mongobackup.sh
Created October 18, 2016 09:13 — forked from colinmollenhour/mongobackup.sh
Simple daily dump of mongo databases.
#!/bin/bash
cd /media/dumps
name=$(date +%b-%d)
year=$(date +%Y)
[ -d $year ] || mkdir $year || { echo "Could not create directory '$year'"; exit 1; }
mongodump --db t3_mage --out $name &> mongodump.log
if [ $? ]; then
tar -czf snapshots/$year/$name.tgz $name
if [ $(($(date +%d | sed 's/^0*//') % 10)) == 0 ]; then
@elfeffe
elfeffe / mysqlsnapshot.sh
Created October 18, 2016 09:10 — forked from colinmollenhour/mysqlsnapshot.sh
MySQL Snapshot Script
#!/bin/bash
DBNAME=mwe
SNAPSHOT_DAYS=7
ARCHIVE_DAYS=60
mysqldump=/usr/bin/mysqldump
gzip=/bin/gzip
function error() {
echo $1 >> $logfile.tmp
@elfeffe
elfeffe / optimize_media.sh
Created October 18, 2016 09:10 — forked from colinmollenhour/optimize_media.sh
Optimize PNG and JPEG images - incrementally
#!/bin/bash
#
# Optimize all jpg and png files in the cwd
# Run it again to optimize new files since the last run
#
# Example:
# echo "optimize_media.sh > /tmp/optimize.log" | sudo -u www-data bash -s
#
# Colin Mollenhour 2016
show global status like 'open%';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE';
show global status like '%Threads_connected%';
set @a=null,@c=null,@b=concat("show tables where",ifnull(concat(" `Tables_in_",database(),"` like '",@c,"' and"),'')," (@a:=concat_ws(',',@a,`Tables_in_",database(),"`))");
Prepare `bd` from @b;
EXECUTE `bd`;
DEALLOCATE PREPARE `bd`;
set @a:=concat('optimize table ',@a);
PREPARE `sql` FROM @a;
EXECUTE `sql`;
DEALLOCATE PREPARE `sql`;
SELECT table_schema "Data Base Name",
sum( data_length + index_length ) / 1024 /
1024 "Data Base Size in MB",
sum( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema ;
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;