Skip to content

Instantly share code, notes, and snippets.

View jhoffmann's full-sized avatar

John Hoffmann jhoffmann

  • Canada
  • 03:27 (UTC -06:00)
View GitHub Profile
@jhoffmann
jhoffmann / SugarCronFilteredJobs.php
Last active November 7, 2019 08:46
Both files go into custom/include/SugarQueue, then run a Repair to regenerate cache/file_map.php and you're good to go.
<?php
if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
}
require_once 'include/SugarQueue/SugarCronJobs.php';
require_once 'custom/include/SugarQueue/SugarJobFilteredQueue.php';
// Sample configuration:
//
#!/bin/bash -eu
if [ -d cache -a -O cache ]; then
if [ `hostname -s` == 'si-admin' ]; then
# send api call to newrelic
fi
else
echo "Either wrong path (not sugar root) or wrong user (run as the owner of the cache folder)"
exit
fi
@jhoffmann
jhoffmann / cache.sh
Created August 23, 2013 16:22
Brute force clear out the SugarCRM cache folder, and repair
#!/usr/bin/env bash
# Symlink as ~/bin/cache for happy fun time excitement.
DO_REPAIR=0
DEFAULT="2"
LEVEL=$DEFAULT
LEVELS[1]="cache/smarty/templates_c"
LEVELS[2]="cache/modules"
LEVELS[3]="cache/jsLanguage cache/themes"
@jhoffmann
jhoffmann / torrent_complete.sh
Created June 28, 2013 12:09
For use with transmission-daemon, enable script-torrent-done-enabled and set this script as script-torrent-done-filename. It will scan your TV folders and try to move the completed torrent into the correct one, by turning both the folder name and torrent name to lower case, stripping out all non alpha characters, and looking for the folder name …
#!/bin/bash
for i in /home/jwh/Downloads/HTPC/TV/*
do
# Look for the TV folder names inside the torrent name
SHOWDIR=`basename "$i" | tr '[A-Z]' '[a-z]' | tr -cd [:alpha:]`
SHOW=`echo ${TR_TORRENT_NAME} | tr '[A-Z]' '[a-z]' | tr -cd [:alpha:]`
if [[ ${SHOW} =~ ${SHOWDIR} ]]
then
@jhoffmann
jhoffmann / .my.cnf
Last active December 17, 2015 07:18
Tweaked config file for local mysql application development (high read low write, low user)
#BEGIN CONFIG INFO
#DESCR: 4GB RAM, InnoDB only, ACID, few connections, heavy queries
#TYPE: SYSTEM
#END CONFIG INFO
#
# This is a MySQL example config file for systems with 4GB of memory
# running mostly MySQL using InnoDB only tables and performing complex
# queries with few connections.
#
<?php
/**
* This allows a user to utilize ElasticSearch (FTS) query syntax when filtering records
* for a module's list view
*
* For the supported syntax, see:
* http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html#_simple_query_string_syntax
*
* @link PSD-1310
* @author jwh
@jhoffmann
jhoffmann / .bash_profile
Created August 22, 2014 18:53
~/.my.cnf
function mydb() { /usr/bin/mysql --defaults-group-suffix=$@ ;}
# brew install exim
# mkdir /usr/local/var/mail
# echo "*: jhoffmann" > /usr/local/etc/aliases
# chmod 644 /usr/local/etc/exim.conf
# chown root /usr/local/etc/exim.conf
# echo "Subject: DO NOT DELETE" | exim foo@bar.com
#
# mutt -F ~/Mail/common.rc -f /usr/local/var/mail/jhoffmann
domainlist local_domains = @