Skip to content

Instantly share code, notes, and snippets.

@billsinc
billsinc / Remove content from Drupal
Created December 17, 2010 00:26
Remove content from Drupal by content type
$node_type = 'lease';
//fetch the nodes we want to delete
$result = db_query("SELECT nid FROM {node} WHERE type='%s'",$node_type);
while ($row = db_fetch_object($result)){
node_delete($row->nid);
$deleted_count+=1;
}
//simple debug message so we can see what had been deleted.
drupal_set_message("$deleted_count nodes have been deleted");
@billsinc
billsinc / gist:768675
Created January 6, 2011 21:56
Date format for import
mmm d, yyyy hh:mm:ss AM/PM
@billsinc
billsinc / catcher.php
Created May 11, 2011 22:48
Parse emails with attachments
#!/usr/bin/php
<?php
//debug
#ini_set ("display_errors", "1");
#error_reporting(E_ALL);
//include email parser
require_once('/var/www/rfc822_addresses.php');
require_once('/var/www/mime_parser.php');
MIME-Version: 1.0
Received: by 10.220.191.194 with HTTP; Wed, 11 May 2011 12:27:12 -0700 (PDT)
Date: Wed, 11 May 2011 13:27:12 -0600
Delivered-To: [email protected]
Message-ID: <[email protected]>
Subject: Test
From: Bill Jncjkq <[email protected]>
To: [email protected]
Content-Type: multipart/mixed; boundary=bcaec54eecc63acce904a3050f79
@billsinc
billsinc / stashboard-pingdom.rb
Created August 3, 2011 17:10 — forked from aboisvert/stashboard-pingdom.rb
Stashboard <-> Pingdom Integration
#!/usr/bin/env ruby
require 'time'
require 'logger'
require 'rubygems'
require 'pingdom-client'
require 'active_support/core_ext/numeric/time' # time extensions, e.g., 5.days
require 'stashboard'
TIME_FORMAT = "%Y-%m-%d %H:%M:%S %Z" # YYYY-MM-DD HH:MM:SS ZZZ
@billsinc
billsinc / gist:1157544
Created August 19, 2011 18:10
Remove Firebird DB from MacOS
#!/bin/sh
echo "Clean Services"
echo "Clean User"
dscl localhost -delete /Local/Default/Users/firebird
echo "Clean Group"
dscl localhost -delete /Local/Default/Groups/firebird
if [ -f "/Library/StartupItems/Firebird" ]; then
echo "Remove SuperServer StartupItem"
rm -fr /Library/StartupItems/Firebird
fi
@billsinc
billsinc / .gitignore
Created October 14, 2011 01:55 — forked from redoPop/.gitignore
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@billsinc
billsinc / gist:4665346
Last active December 4, 2019 15:06
Find Largest Files/Directories on Linux System
# 10 Largest Files
find . -type f -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}
@billsinc
billsinc / gist:7979188
Created December 15, 2013 22:28
Ruby format US phone number with area code
validates :phone_number, format: { with: /\d{3}-\d{3}-\d{4}/, message: "bad format" }
@billsinc
billsinc / install_script.sh
Created May 28, 2014 21:28
Install Odoo on Centos
#!/bin/sh
yum -y install wget unzip
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh http://yum.pgrpms.org/9.2/redhat/rhel-6-i386/pgdg-centos92-9.2-6.noarch.rpm
yum -y install python-psycopg2 python-lxml PyXML python-setuptools libxslt-python pytz \
python-matplotlib python-babel python-mako python-dateutil python-psycopg2 \
pychart pydot python-reportlab python-devel python-imaging python-vobject \
hippo-canvas-python mx python-gdata python-ldap python-openid \
python-werkzeug python-vatnumber pygtk2 glade3 pydot python-dateutil \
python-matplotlib pygtk2 glade3 pydot python-dateutil python-matplotlib \